CFLOCATION (or redirect) after X amount of time

I do not want to use a meta refresh/redirect or Javascript.

I would like to have either a page refresh or redirect to another page on a website which refreshes the page or redirects the page after X seconds/minutes, but have the interval be a RandNum() generated time that is created each time it is refreshed or redirected.  I want to create a LOOP of refreshes without (again) Meta or Javascript.

I do NOT want any user interaction from the browser page and have no idea how to do this random interval using the CF Administrator TASK panel (which was my first thought).

I'm stuck on the approach and need to HIDE the refresh coding from the HTML source code so that it can't be read by anyone... which is why I prefer only ColdFusion to do this.

Is this possible using the server session variables which have a time monitoring aspect?  The key for me is that I want this loop to run without a browser user having to interact with it once it starts the loop.
Who is Participating?
Pravin AsarConnect With a Mentor Principal Systems EngineerCommented:
afaik can't be done using standard html

the server has no awareness of client state & vice versa (other than session timeout) You can't "push" a location move to a client (imagine the chaos that could create)

the client must poll the server via ajax to see if some condition is met or you need a client based timer.

cflocation -itself- is client side - basically just a 302 Temp Moved flag
Pravin AsarPrincipal Systems EngineerCommented:
It can be even simple html code

<META HTTP-EQUIV=Refresh CONTENT="10; URL=index.html/">

This will send the visitor off to your index page after a 10 second spell has elapsed.
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

day6Author Commented:
Pravinasar, if you read my entire post, I don't want to use META or Javascript.
hmmm that's interesting - seems like it probably could push a message to a js listener and then window.location ... might just work

so to revise my original . pre-CF10 you probably can't do it.
day6Author Commented:
Ok, I'm sure there is a connection between sending a message to a specific user and my question, but I have NO idea what it is.  I'm wanting a random timed page redirect using two .cfm scripted pages which just bounce back and forth to each other for "x" time and in an endless loop... but obviously not having the same pattern of intervals.

Secondly, there will not be anyone observing these pages (an actual client) but just an open browser window as the host to facilitate this.
SidFishesConnect With a Mentor Commented:
I don't think you're going to get any cut & paste code but the idea is to take pretty much the example from Ben and modify main.js

function( event, data ){

window.location.href = "yoururl.cfm"


You'd have to figure out how to control the back & forth between windows

on the other hand - I have no idea if it's even do-able this way. Just know it's not any -other- way.
Pravin AsarPrincipal Systems EngineerCommented:
Glad to be of some help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.