CFLOCATION  
Description

Stops page execution and opens a ColdFusion page or HTML file.

 
Category

Flow-control tags, Page processing tags

 
Syntax
    <cflocation
   url = "url"
   addToken = "Yes" or "No">

  
 
See also

cfabort, cfbreak, cfexecute, cfexit, cfif, cfloop, cfswitch, cfthrow, cftry

 
Usage

You might write a standard message or response in a file, and call it from several applications. You could use this tag to redirect the user's browser to the standard file.

If you use this tag after the cfflush tag on a page, an error is thrown.

Warning: Do not set a cookie variable on a page on which you use this tag. If you do, the cookie is not saved on the browser. Similarly, if you use a cookie to store a client variable, the client variable is not set.
 
Example
<!--- This view-only example shows the use of cflocation --->
<h3>cflocation Example</h3>
<p>This tag redirects the browser to a web resource; normally, you would 
use this tag to go to a CF page or an HTML file on the same server. 
The addToken attribute lets you send client information to the 
target page.
<p>This code redirects you to CFDOCS home page (if you remove the comment 
marks, this information displays in frame):
<!--- <cflocation url = "../cfdocs/index.htm" addToken = "No"> --->
URL  
  Required
 

URL of HTML file or CFML page to open.

ADDTOKEN  
  Optional
 

clientManagement must be enabled (see cfapplication).

  • Yes: appends client variable information to URL
  • No