Name
cflocation
Synopsis
<cflocation>
Redirects
the user’s browser to a new location. Due to the way
ColdFusion assembles dynamic pages, you shouldn’t
attempt to use the cflocation
tag within a
template after a cookie variable has been set. Setting a cookie
variable and using cflocation
afterward results in
the cookie not being set. If you need to redirect to a different
template after setting a cookie, consider using the
cfheader
tag instead, as in:
<cfcookie name="MyCookie" value="Hey, look at me!"> <cfheader name="Refresh" value="0; URL=http://www.example.com/mytemplate.cfm">
Or:
<cfheader name="Location" value="mytemplate.cfm"> <cfheader statuscode="302" statustext="Document Moved">
Attributes
-
URL="
URL
"
The URL to redirect the user’s browser to. Required.
-
addtoken="Yes|No"
Whether or not to append client variable information to the end of the URL specified in the
URL
attribute. In order to use theaddtoken
attribute,clientmanagement
must be turned on in the Application.cfm file. Optional. The default isYes
.
Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.