Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cookie Help

Status
Not open for further replies.
May 21, 2002
19
0
0
US
I have a javascript that sets a cookie to redirect the user to a specific page which works just fine. However now I need it to redirect if the cookie is not set and stay on the page if the cookie is set. Here is the portion of the script that does the redirect. Basically I want to redirect back to the index.htm page if the cookie isn't set. Any ideas?

function get() {
email = Get_Cookie("name");
if (name != null) {
window.location.href = 'page2.htm';
}
 
I'm getting close with this:
====
function get() {
email = Get_Cookie("name");
if (name != null) {
window.location.href = 'samepage.htm ';
}
else {
window.location.href = 'index.htm';
}
====
However the line
windows.location.href- 'samepage.htm';
Throws the page into a loop. So I need to say something like if blah blah then do nothing else .... any ideas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top