Dan
Dan

Reputation: 463

Avoid page reload when browser back button is clicked

I am using jQXwidgets, something like the following from here. As seen in Image #1, I am on the 91-100 section of the list which is last. Suppose I click on first record which is Regina I will move onto next page in my website. However, when I click the browser back button, it reloads the page and I am back to the first list with 1-10 as shown in the image #2

Questions:

Is it possible with the browser back button to land on the same list 91-100 where Regina name is listed? Or do I need to add back button and do what to achieve that? Please advise. Thanks

Image #1: enter image description here

Image #2:enter image description here

Upvotes: 2

Views: 6801

Answers (1)

catbadger
catbadger

Reputation: 1842

You'll need some javascript that cancels the event.

<script>    
history.pushState(null, null, document.URL);
   window.addEventListener('popstate', function () {
   history.pushState(null, null, document.URL);
});
</script>

try that?

Upvotes: 3

Related Questions