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 3 of 3
  1. #1
    Regular Coder Apothem's Avatar
    Join Date
    Mar 2008
    Posts
    380
    Thanks
    36
    Thanked 25 Times in 25 Posts

    Getting the referrer's URL without the need of clicking a link

    I realized that the $_SERVER['HTTP_REFERER'] [or getenv('HTTP_REFERER')] would only return its referrer's URL only if I was directed to my site via a link (i.e. <a href="...">...</a>); it wouldn't return the referrer's URL if I typed in the link to my website OR if I clicked it through my Firefox's Bookmarks

    How can I get the user's last URL even if they typed in the URL to my site or clicked it through something like My Bookmarks?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    You can't. HTTP_REFERER isn't reliable to begin with since its value is provided by the browser. If this data is not set, you cannot force it to set it.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by Pykex View Post
    I realized that the $_SERVER['HTTP_REFERER'] [or getenv('HTTP_REFERER')] would only return its referrer's URL only if I was directed to my site via a link (i.e. <a href="...">...</a>); it wouldn't return the referrer's URL if I typed in the link to my website OR if I clicked it through my Firefox's Bookmarks

    How can I get the user's last URL even if they typed in the URL to my site or clicked it through something like My Bookmarks?
    The only way around this is to build you own browser that send the header even on click of button and good look there lol
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)


  •  

    Posting Permissions

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