Hit back button -- go to TOP of page

after hitting ‘back’ button I’m taken to spot on page where I was, but I’m being asked to do the opposite – take user to the top of the page, after hitting ‘back’ button…

when I look up this issue, most people complain of the opposite - that the browser takes them to to top of the page after hitting ‘back’ button…:wink:

http://www.google.com/search?q=javascript+back+button+go+to+top+of+page&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

is there a way with JavaScript to force page to go to the top of the page when you navigate to a back via ‘back’ button?

thank you…

yeah, I thought so… it’s just that I was asked to do this at work and wanted to be 100% that it was undoable when I told them… :wink: thank you…

Not that I’m aware of, most browsers don’t trigger a refresh when you use the navigation buttons so even if you had a script, there’s no effective way to detect that the back button was clicked and that the action you want should be undertaken. The only way I can think of which may be able to do the trick is to give links the anchor fragment # (so like index.html#) thereby the browser “should” see that it needs to go to a section of the page and as there’s no fragment identified it should jump to the top of every page by default. Hopefully that might work, but otherwise you’re probably out of luck in this case. :slight_smile:

oops… in that last sentence meant:

is there a way with JavaScript to force the browser to take user to the top of the page when they navigate to a page via ‘back’ button?

thank you…