Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Abort page load and redirect?by FuBaR (Acolyte) |
on Apr 09, 2005 at 18:59 UTC ( [id://446281]=perlquestion: print w/replies, xml ) | Need Help?? |
FuBaR has asked for the wisdom of the Perl Monks concerning the following question:
Hello all, Is there any way to have a script load on a web page and if in the script a condition is met to have it abort the page load and redirect to another page? The whole idea is I dont want to call the script from a link. That would be easy but the user could just type in the page and go there directly. This isn't meant to stop someone who really wants to see the page, just a normal user navigating via the links or typed in in the address bar directly. I want to have it so that if a condition is met they will NOT view the page they were loading and only view the page they are being redirected to. I know this is a silly little excersise but since I couldn't get it to work the way I want it has me curious. Calling the script isn't my problem...well maybe the WAY I'm calling it is but the script does run and check the condition. What is failing is the redirect. using the exec SSI call is not an option so i call the script with a <script src="script.pl"></script> tag in the head of the html document. Everything works fine up until this point in the script: All that happens is the page that was being loaded is displayed. I know that the code inside the if statment IS being executed with a proper URL. It's just not doing what I want. Any ideas?
Back to
Seekers of Perl Wisdom
|
|