0

I have a website having frames. Clicking on button in one frame updates the pages to be loaded in other frames. Now when user press the back button few of the frames load previous pages. i want user not to move back to previous page. I used the code history.forward() on onload event of all my pages. This works fine when back is pressed. User got navigated to most recent page always. But the case is suppose user navigate to number of pages by clicking on button in first frame which updates the pages to be loaded in other frames. After navigation user select a page from the list of browsing history, then it is move forward to only one page, not the last page he was viewing. This Happens in IE. In firefox it works fine. User can select any page from the browsing history, he is relocated to most recent page

pnuts
  • 58,317
  • 11
  • 87
  • 139
saurabh
  • 1
  • 1
  • 2
  • possible duplicate of [Disable browser's back button](http://stackoverflow.com/questions/961188/disable-browsers-back-button) – David Passmore Apr 13 '15 at 16:45

2 Answers2

0

write this code between script tags

    history.pushState(null, null, location.href);
    window.onpopstate = function () {
        history.go(1);
    };
0

My opinion is, you should review your concept, because you want to "reconfigure" the browser's navigation buttons. Disabling browser features is in my eyes old fashioned.

I used the code history.forward() on onload event

Try following this way:

In the head section, insert the javascript:

var historySize = history.length;

Then replace in onload event: history.forward() by history.go(historySize - 1). A positive value means move forward to a particular position in browser's history object (array).

I cannot guarantee that it will work, but it is worth to try out.

gvlasov
  • 18,638
  • 21
  • 74
  • 110
Reporter
  • 3,897
  • 5
  • 33
  • 47