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

CFLocation after CFFlush

Contributor ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

Hello,

I need to make a user pause for 5 seconds when another user is completing a particular task. I can't figure out why my cflocation tag doesn't execute after the cfflush is done. If I remove the cffush it works. What am I missing?

Thanks in advance for any assistance.

<style>

.loader {

  border: 16px solid #f3f3f3;

  border-radius: 50%;

  border-top: 16px solid blue;

  border-right: 16px solid green;

  border-bottom: 16px solid red;

  border-left: 16px solid pink;

  width: 120px;

  height: 120px;

  -webkit-animation: spin 2s linear infinite;

  animation: spin 2s linear infinite;

}

@-webkit-keyframes spin {

  0% { -webkit-transform: rotate(0deg); }

  100% { -webkit-transform: rotate(360deg); }

}

@keyframes spin {

  0% { transform: rotate(0deg); }

  100% { transform: rotate(360deg); }

}

</style>

<cfflush>Please Wait. Another user is creating a configuration file.<br>

<div class="loader"></div>

<cfflush>

<cfscript>

thread = CreateObject("java","java.lang.Thread");

thread.sleep(5000);

</cfscript>

<cfflush>

Done!

<cflocation url="../home.cfm" addtoken="no">

why didn't it load?!?

Views

494

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

correct answers 1 Correct answer

Community Expert , Feb 15, 2019 Feb 15, 2019

You can't use CFLOCATION after CFFLUSH. This is not a CF issue, it's just how HTTP works. CFFLUSH returns the HTTP response headers along with part of the HTTP response body (the page). CFLOCATION returns a specific HTTP response header telling the browser to go to another page. By the time you're displaying part of the body of the page, it's too late to tell the browser to go to another page using HTTP response headers.

Dave Watts, Eidolon LLC

Votes

Translate

Translate
Community Expert ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

You can't use CFLOCATION after CFFLUSH. This is not a CF issue, it's just how HTTP works. CFFLUSH returns the HTTP response headers along with part of the HTTP response body (the page). CFLOCATION returns a specific HTTP response header telling the browser to go to another page. By the time you're displaying part of the body of the page, it's too late to tell the browser to go to another page using HTTP response headers.

Dave Watts, Eidolon LLC

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
Contributor ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

LATEST

Thanks!  I was able to achieve what I needed with a javascript redirect.

<script type="text/javascript"> 

    function Redirect()

    {

        window.location="http://www.google.com";

    }

    document.write("Trying Again");

    setTimeout('Redirect()', 1000); 

</script>

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