Javascripts not working on browser back

Discussion in 'JavaScript' started by Jamie18, Dec 24, 2007.

  1. #1
    i've got a couple javascripts that run on page load (bodyonload) that explode when the user navigates to the page using the browsers back button. I'm having the problem in IE6, no problem in firefox.

    This script is used to set different select menus on the page based on information in the database.. however, when the back button is used as opposed to normally navigating to this page the select menus selected indexes turn out incorrect..

    is there any easy way to tell if the user has navigated to the page by the back button? so i could just send them to another page..

    or has anyone else ever seen this problem? and possibly know how to implement a solution..

    unfortunately i can't post the code.. but i can tell you that the <script> tags aren't in the head section if that has anything to do with it.. i would have to do a large site remodel in order to make it that way..

    i just have no idea why this would ever occur...
     
    Jamie18, Dec 24, 2007 IP
  2. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    in addition this site has no doctype.. and i just checked safari on windows and i'm getting the same problem...

    although i've attempted to include a valid doctype and that didn't seem to make a difference..


    My guess is there's something different about when the onload functions are run when you hit the back button and when you normally navigate to the page.. whatever it is it's blowing my mind
     
    Jamie18, Dec 24, 2007 IP
  3. MyDVDz

    MyDVDz Member

    Messages:
    35
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #3
    Hi
    You need server side scripting for cache-control and session management
     
    MyDVDz, Dec 26, 2007 IP
    Jamie18 likes this.
  4. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    thank you..

    i've set it to no-cache and it seemed to do the trick
     
    Jamie18, Dec 27, 2007 IP