PDA

View Full Version : Print "Location: url does not redirect to url


Jeepers
08-18-2002, 04:00 PM
Hi Guys

Still struggling with Perl so please forgive this 'basic' question.

I have a couple of other scripts that work fine using

print "Location: url---

to display a page in the clients browser. This new script I'm using just prints the url to the browser window. I understand this is because the content-type is text/html (according to a search and answer by Feyd.

I can print a content refresh to url in html from the script that works ok but it is slow. What do I need to do to ensure that I can use print "Location:.

I have tried a few things but they all just print to the browser.

Thanks.

Jeepers
08-18-2002, 11:56 PM
I've found it.

Early on in the script among a tribe of comments there is the statement

print "Content-type is set to text/html \n\n";

to make sure that the contents of a text file, should it be requested, were printed to the screen. What a bummer, I've spent ages and ages trying to get it to work, I suppose that is the price you pay when you use other peoples (with permission) scripts.

andy7t
08-20-2002, 11:54 AM
Your friend was absolutly right.
You can't have at the top:
print "Content-Type text/html\n";

It just won't work.
So delete that line.

After that it should work.
Mail me at info@warzone-game.co.uk with your url and the script if you need any more help.
I'll have a look at the script for you.

pkchukiss
08-30-2002, 02:28 PM
If you want to redirect the browser to a new URL, you should add "\n\n" behind your browser command as in this:

print "Location: http://www.somewhere.com/\n\n";