Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Conwy. UK
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Conwy. UK
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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";


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •