Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-18-2002, 04:00 PM   PM User | #1
Jeepers
Regular Coder

 
Join Date: Jun 2002
Location: Conwy. UK
Posts: 122
Thanks: 0
Thanked 0 Times in 0 Posts
Jeepers is an unknown quantity at this point
Print "Location: url does not redirect to url

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.
__________________
An answer needs a question just as much as a question needs an answer. Deep eh!
Jeepers is offline   Reply With Quote
Old 08-18-2002, 11:56 PM   PM User | #2
Jeepers
Regular Coder

 
Join Date: Jun 2002
Location: Conwy. UK
Posts: 122
Thanks: 0
Thanked 0 Times in 0 Posts
Jeepers is an unknown quantity at this point
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.
__________________
An answer needs a question just as much as a question needs an answer. Deep eh!
Jeepers is offline   Reply With Quote
Old 08-20-2002, 11:54 AM   PM User | #3
andy7t
New to the CF scene

 
Join Date: Aug 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
andy7t is an unknown quantity at this point
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.
andy7t is offline   Reply With Quote
Old 08-30-2002, 02:28 PM   PM User | #4
pkchukiss
New to the CF scene

 
Join Date: Aug 2002
Location: Singapore
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
pkchukiss is an unknown quantity at this point
You forgot something:

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";
pkchukiss is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:42 PM.


Advertisement
Log in to turn off these ads.