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 7 of 7
  1. #1
    New Coder
    Join Date
    Nov 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    window.location and http_referer

    Anyone know why when you do a

    window.location = "new_url" the http_referer environmental is not set?

    i've pretty much got everything working except this little bit..

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is this with just one browser or did you test it on several browsers?
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New Coder
    Join Date
    Nov 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i tried it on mozilla/NS7 and IE5 and IE6

    i think it has something to do with the fact that window.location may not be treated the same as a link.. its not actually linking to a page it is just changing the window.location to a new value.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    My testing in IE6 shows the behavior you're suspecting. But in Firefox, it runs fine, the referer shows in all instances.

    In IE6, using location.href will not set the HTTP_REFERER. Normal links will do. But the funny thing is using window.open(url, '_self') will show the referer but only if the last previously clicked is a normal link.
    Try running this simple demo.

    page 1:
    Code:
    <html>
    <body>
    <form>
    <input type="button" value="Open using location.href" onclick="location.href='page2.asp'" />
    <input type="button" value="Open using window.open(url, _self)" onclick="window.open('page2.asp', '_self')" />
    <input type="button" value="Open in new window" onclick="window.open('page2.asp', '_blank')" />
    <a href="page2.asp">page 2 link</a>
    </form>
    </body>
    </html>
    page2.asp:
    Code:
    <%
    response.write "Referer:" & request.servervariables("HTTP_REFERER")
    %>

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As I suspected (but didn't have the time to check), it's a browser implementation problem. Unfortunately that means you can't do anything to fix it, you have to find a way to work around it.
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #6
    New Coder
    Join Date
    Nov 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yea i just ended up passing it through the QUERY_STRING, its a little undesirable but that is the way it goes..

    it is essentially just a convienence to be able to send the user back to their original page when they go through some login steps..

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not just convenient, it's polite. Good for you.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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