View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cflocation PreviousNext

cflocation

Stops execution of the current page and opens a ColdFusion page or HTML file.

Flow-control tags, Page processing tags

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

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

Attribute

Req/Opt

Default

Description

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

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.

This tag has no effect if you use it after the cfflush tag on a page.

<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>If you remove the comments, this code redirects you to CFDOCS home page:

<!--- <cflocation url = "http://localhost:8500/cfdocs/dochome.htm"
addToken = "No"> --->

Contents > CFML Reference > ColdFusion Tags > cflocation PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


tomj said on Aug 7, 2003 at 11:30 AM :
The default for the AddToken attribute is YES
markus einfinger said on May 7, 2004 at 4:53 AM :
If I use cflocation to relocate to another site, no referer is available on that site... :-(

Has anybody an idea how I could make a relocation where the referrer is passed to the next page?

I already tried javascript (location.href=...) and meta refresh as well - no referer available!

My problem: I have an ad banner with a link to a cfm script that counts the clicks. After that, I want to relocate to that specific target site.
(e.g. www.mydomain.com/link.cfm?link=www.otherdomain.com)
--> the script link.cfm counts the clicks and on www.otherdomain.com, the referer should be www.mydomain.com/link.cfm.

Thanks a lot,
Markus
ASandstrom said on May 7, 2004 at 5:57 AM :
LiveDocs does not receive enough traffic to handle questions such as this. I suggest posting your issue to the online forums:
http://webforums.macromedia.com/coldfusion/
No screen name said on Sep 13, 2006 at 4:03 PM :
Hi, with firefox there is a difference between http://mysite.com and http://www.mysite.com

When a visitor enters with http://mysite.com and set some session variables. Then you do a cflocation to http://www.mysite.com the visitor gets a new session (thus your variables are gone).

In explorer the visitor keeps the same session, but not in firefox
(lasted me 5 hours to figure this out)

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p70.htm