简体   繁体   中英

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: 在此处输入图片说明

Image #2: 在此处输入图片说明

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM