473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Page Redirection problem

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.

Apr 5 '06 #1
3 1266
sorry i am not sure if i fully understand. can you be a bit more
elaborate. thanks

Apr 6 '06 #2
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

Apr 6 '06 #3
pe********************@gmail.com 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.
<URL: http://www.safalra.com/special/googlegroupsreply/ >
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: TG | last post by:
Dear PHP Group, How can I in PHP, based on a result, move the cursor to a certain location on the page? I want the same result as Anchor tags in HTML. I want to go to a certain section of the...
10
by: Matt Adams | last post by:
A web page which exists for a couple of years under a certain address (e.g. http://www.aaa.com/bbb/ccc.html) is (should be) moved to another location (e.g....
0
by: itsharkopath | last post by:
Hi, Imagine a user in a hotspot, when he comes to the hotspot and tries to load a webpage (on the internet), he would automatically redirected to login page. I believe the following is to be...
12
by: ACaunter | last post by:
Hi all, I was wondering how i could write some code which would automatically open the Login Page once the session has expired? -- AdamPC@hotmail.com
1
by: craigkenisston | last post by:
Hi, I recently read a lot about a topic called page hijacking. It seems that you can steal page rank from search engines while doing a redirect. I reminded I had a code in some pages, where...
2
by: Dr. Paul Caesar - CoullByte (UK) Limited | last post by:
Hi, I have created a Logout ASP.NET application using Forms Authentication. When a user logs out they get a confirmation page confirming logout and a button to click to return to the homepage....
10
by: Eric Lindsay | last post by:
This may be too far off topic, however I was looking at this page http://www.hixie.ch/advocacy/xhtml about XHTML problems by Ian Hickson. It is served as text/plain, according to Firefox...
3
by: Advo | last post by:
is there any reason why i can view a page at work (which is on our server) yet when i view it online from the domain name (some pages are hosted, some are running off our server) i get the message:...
6
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, We have two sites hosted on different servers and we have many pages on domain A which has many links(asp programs) to domain B. My question is if domain B server is in trouble, what is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.