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 8 of 8
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    South East UK. 35 miles east of London, in sight of the River Thames.
    Posts
    300
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Remember each pages referring page.

    Hi All,

    I need a script (triggered by body onLoad) that will store and display in an alert box, the url of the previous page to the one displayed. That is, I need to know the url of the page that called the one currently on the screen.

    I know that document.referrer is not reliable across all versions of IE and that you can't get at the 'History' function anymore.

    If any one can come up with a javascript/javascripted process to solve this one, they would have a good site access security product that people would pay for.

    Any idea's?

    Regards

    Gary

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's nothing to do with IE per se, it's just that browsers and proxy servers can be configured not to send referer information with requests. There isn't a workaround - if referer information isn't there there's no process that can get it.

    What do you really want? If you're looking to validate a mailform or something like that, PHP or ASP session validation is probably your best bet.
    Last edited by brothercake; 10-06-2003 at 08:54 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    btw - I deleted your other thread which was almost the same as this. Please don't start multiple threads on the same subject.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Regular Coder
    Join Date
    Sep 2002
    Location
    South East UK. 35 miles east of London, in sight of the River Thames.
    Posts
    300
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Remember each pages referring page

    Hi Brothercake,

    I need to make sure that the visitor to the site enters from the front page and cannot view a subsequent page by having bookmarked it on a previous visit and 'jump' straight in. As 'referrer' and 'history' are not suitable, how can I store the current pages URL so that the next page can test if the referring page is acceptable?

    Regards

    Gary

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts

  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    South East UK. 35 miles east of London, in sight of the River Thames.
    Posts
    300
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Hi Glenn,

    I started with request.servervariables("HTTP_REFERER") but the problem is that it is not always available, or am I doing something wrong (like trying to becone a programmer!).

    Cheers

    Gary

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    the reason for that is what brothercake mentioned in his first post. Use session validation instead of checking referrer.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you have to establish a session on your front page. On subsequent pages you check for that session variable, and if it isn't there do a redirect or whatever.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

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