• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1451
  • Last Modified:

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.
0
day6
Asked:
day6
  • 3
  • 3
  • 2
2 Solutions
 
SidFishesCommented:
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

http://www.petefreitag.com/item/359.cfm
0
 
Pravin AsarCommented:
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.
0
 
day6Author Commented:
Pravinasar, if you read my entire post, I don't want to use META or Javascript.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Pravin AsarCommented:
0
 
SidFishesCommented:
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.
0
 
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.
0
 
SidFishesCommented:
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

 socket.on(
"message",
"demo",
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.
0
 
Pravin AsarCommented:
Glad to be of some help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now