Page Redirection problem

S

sconeek

hi all,

i am working on a web based java application. now i have this HTML page
which gets refreshed every 2 seconds (using javascript). now i also
want to redirect the user from this page to another page after
10seconds.

i have implemented user redirection using javascript and it works fine
on static pages. the problem is on a page which is being updated every
2 seconds, my timer gets resetted every 2 seconds and hence i am unable
to capture the entire 10second waiting period. i am thinking of doing
something perhaps on the server end using java instead of on the client
side, but there has to be a way of fixing this problem on the client
side.

can somebody help me out. thanks heaps.
 
L

Lee

(e-mail address removed) said:
hi all,

i am working on a web based java application. now i have this HTML page
which gets refreshed every 2 seconds (using javascript). now i also
want to redirect the user from this page to another page after
10seconds.

i have implemented user redirection using javascript and it works fine
on static pages. the problem is on a page which is being updated every
2 seconds, my timer gets resetted every 2 seconds and hence i am unable
to capture the entire 10second waiting period. i am thinking of doing
something perhaps on the server end using java instead of on the client
side, but there has to be a way of fixing this problem on the client
side.

Add a parameter to the query string (eg, "?count=5"
Decrement the parameter with each refresh and when it hits zero,
redirect to the other page instead of refreshing.


--
 
S

sconeek

sorry i am not sure if i fully understand. can you be a bit more
elaborate. thanks
 
P

pegasusflightresources

One quick recommendation:
Just have some kind of counter using cookies, and once the cookie count
has reached 5 (as 5*2 is 10), then have the JavaScript redirect the
page using 'location.href'. Cookie access and deletion is possible in
JavaScript, although I have not mastered it. In your secondary page
(the one being redirected to), you could have a simple JavaScript that
deletes the previous cookie so that no interference will happen.

Another possibility for refreshing after 2 seconds is just to use a
meta tag for refreshing. Online, there are many sites that show you
how to use the meta refresh tag, so use those as reference in the case
that that will work. The cookie option would be added as a script to
this page so that you would still have that 10 second redirect.

_____________________________________

I remain your most humble and Ob't Sv't in our battle against the King.

Patrick Reilly
1st Coy.
Colonel Seth Warner's Regiment
 
R

Randy Webb

(e-mail address removed) said the following on 4/6/2006 4:34 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.
One quick recommendation:
Just have some kind of counter using cookies, and once the cookie count
has reached 5 (as 5*2 is 10), then have the JavaScript redirect the
page using 'location.href'. Cookie access and deletion is possible in
JavaScript, although I have not mastered it. In your secondary page
(the one being redirected to), you could have a simple JavaScript that
deletes the previous cookie so that no interference will happen.

And if cookies are disabled but JS is enabled?
Another possibility for refreshing after 2 seconds is just to use a
meta tag for refreshing.

IE6 allows the explicit disabling of META refreshes.
Online, there are many sites that show you how to use the meta refresh
tag, so use those as reference in the case that that will work.

Don't, as most "on-line tutorials" are junk and not worth reading.
The cookie option would be added as a script to this page so that you
would still have that 10 second redirect.

The solution that Lee gave doesn't require cookies (doesn't even use
them in fact).

Read the current URL.
Get the parameter.
If its 10, redirect elsewhere
Add 2 to parameter.
set location.href to the location.href with the new counter added.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,049
Members
48,769
Latest member
Clifft

Latest Threads

Top