• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

cflocation redirect

Explorer ,
Nov 09, 2009 Nov 09, 2009

Copy link to clipboard

Copied

Hi,

i have written  follwing code in coldfusion page

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function test()
{
location.href='test1.cfm';
}
</script>

</head>

<body onLoad="test()">

<cflocation url="test.cfm" addtoken="no">

</body>
</html>

while excuting this page cflocation url is excuting first not javascript url why this happens?

Advance thanks

TOPICS
Advanced techniques

Views

635

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2009 Nov 09, 2009

Copy link to clipboard

Copied

The javascript runs when the html body loads.  However, it never loads because the the cflocation tag is before the closing body tag.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 09, 2009 Nov 09, 2009

Copy link to clipboard

Copied

LATEST

CFML runs on the CF server long before the mark-up gets sent to the client browser.  Indeed in this case, no mark-up gets sent to the borser because as soon as CF encounters the <cflocation> it sends a redirect response to the client browser, which is done solely by sending a HTTP header, with no content at all.

--

Adam

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation