yingkit
asked on
Detect and redirect
Hi,
How can I do the following?
If my visitor tries to acesss a particular HTML files of my homepage DIRECTLY, say "download.html", my homepage will then automatically redirect him back to "index.html" with "download.html" being opened in the "RIGHT" frame.
Thanks in advance.
PS. Javascript answers preferred.
How can I do the following?
If my visitor tries to acesss a particular HTML files of my homepage DIRECTLY, say "download.html", my homepage will then automatically redirect him back to "index.html" with "download.html" being opened in the "RIGHT" frame.
Thanks in advance.
PS. Javascript answers preferred.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for more indepth look into url vars check out:
http://developer.iplanet.com/viewsource/goodman_url_pass/goodman_url_pass.html
CJ
http://developer.iplanet.com/viewsource/goodman_url_pass/goodman_url_pass.html
CJ
ASKER
Hi CJ,
Can you post the some sample html files here, or tell me which file(s) should the scripts be placed at?
Moreover, whenever download.html with the following code is loaded, it causes my netscape4 to split frames continuously:
<script>
urlvar = window.location.href;
if (urlvar.search('download.h tml') != -1) {
window.location.href="inde x.html"
}
</script>
Thanks.
Can you post the some sample html files here, or tell me which file(s) should the scripts be placed at?
Moreover, whenever download.html with the following code is loaded, it causes my netscape4 to split frames continuously:
<script>
urlvar = window.location.href;
if (urlvar.search('download.h
window.location.href="inde
}
</script>
Thanks.
oops small problem in the code:
need to use:
<script>
urlvar = window.parent.location.hre f;
//or urlvar = window.parent.location.pat hname;
if ((urlvar.search('download. html')) != -1) {
alert("redirecting");
window.location="index.htm l";
}
</script>
if you don't use parent... it doesn't look at the top window but the current frames location so you always found the download.html if it was loaded in that frame.
Sorry,
CJ
need to use:
<script>
urlvar = window.parent.location.hre
//or urlvar = window.parent.location.pat
if ((urlvar.search('download.
alert("redirecting");
window.location="index.htm
}
</script>
if you don't use parent... it doesn't look at the top window but the current frames location so you always found the download.html if it was loaded in that frame.
Sorry,
CJ
<script>
urlvar = window.location.href;
if (urlvar.search('download.h
window.location.href="inde
}
</script>
I understand that index.html is a page with all the frameset definitions in which case you can load the download.html on the right frame.
DC