FIX: Browser back button doesn’t reload page in JavaScript

Milan Stanojevic
by Milan Stanojevic
Windows & Software Expert
Milan has been enthusiastic about PCs ever since his childhood days, and this led him to take interest in all PC-related technologies. Before joining WindowsReport, he worked as a front-end web developer. Read more
Affiliate Disclosure
  • If the browser's back button is not reloading the page, it might be a problem with JavaScript.
  • The back button does not reload the page and that means that you can't go back to the previously loaded webpage.
  • One obvious solution to avoid this problem is to start using a different browser.
  • You can also fix this issue with a cleverly devised JavaScript command that you can see below.
back button doesn't work
Strugling with your current browser? Upgrade to a better one: OperaYou deserve a better browser ! 350 million people use Opera daily, a fully-fledged navigation experience that comes with various built-in packages, enhanced resource consumption and great design. Here's what Opera can do:

  • Easy migration: use the Opera assistant to transfer exiting data, such as bookmarks, passwords, etc.
  • Optimize resource usage: your RAM memory is used more efficiently than in other browsers
  • Enhanced privacy: free and unlimited VPN integrated
  • No ads: built-in Ad Blocker speeds up loading of pages and protects against data-mining
  • Gaming friendly: Opera GX is the first and best browser for gaming
  • Download Opera

Quite a few users, and especially programmers encountered an issue when working in JavaScript. They want to be able to reload the webpage the user is observing by using the back button inside the browser.

If the code fails to update the cached data from the initial page, the back button will show the cached data, but without the latest data updates applied.

This can cause a lot of confusion especially if the webpage you’re working on is a complex project with a lot of complicated commands.

If the browser back button persists and the page is not working, you will be able to fix it with our solutions below.

Even though each browser manages cache differently, the fix we’re discussing in this article will be using JavaScript, so it applies to any browser. Read on to find out how to do it.

The solutions also cover the Safari back button does not reload page issue so make sure you read them carefully.


What can I do if the back button doesn’t reload the page?

1. Try a different browser

Even the most famous browsers can prove to be prone to errors and bugs and the back button issue is just one of the examples.

If you got tired of your current browser and you’re looking to switch to a new and better one, try Opera. It’s fast, secure, privacy compliant, fully customizable, and, most of all, it’s free.

More so, it is frequently updated, and therefore improved upon, so any bug you may happen to find will never stay there for long anyway.

It comes with an ad blocker, built-in social network shortcut buttons for Messenger, Instagram, and WhatsApp, and also a built-in VPN. The VPN service is free to use and doesn’t have any bandwidth limitations.

Opera

Opera

Choose this browser and never have to worry about coding problems like JavaScript-related issues. Available for download for free!

2. Create a command for the List layer

Because Maintenance applications have two pages – the List and Maintain view, we will tackle this issue focusing only on the List page.

In order to achieve reloading cached data when users press the back button of a web-page inside a browser, you will need to copy-paste this command directly before the </head> tag, inside the source view of the List layer: 

<script type="text/javascript">
       jQuery(document).ready(function()
        {
                var d = new Date();
                d = d.getTime();
                if (jQuery('#reloadValue').val().length == 0)
                {
                        jQuery('#reloadValue').val(d);
                        jQuery('body').show();
                }
                else
                {
                        jQuery('#reloadValue').val('');
                        location.reload();
                }
        });
   </script>

After this code is added to your List layer, you will also need to add a line of code after the End data Table text:

<input id =''reloadValue'' type =''hidden'' name =''reloadValue'' value=''/>

After this process is done, the user that is browsing your website will be able to reload the previous page with the updated live cache data, by simply clicking the back button.


Please feel free to let us know if this short guide helped you solve your issue in JavaScript.


idee restoro Still having issues? Fix them with this tool:
  1. Download this PC Repair Tool rated Great on TrustPilot.com (download starts on this page).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues with Patented Technologies (Exclusive Discount for our readers).

Restoro has been downloaded by 0 readers this month.

Frequently Asked Questions

  • The back button of a browser allows users to return to a web page they previously visited. Here’s what to do if the back button doesn’t refresh the page.

  • Users cannot disable the back button of a browser. Only the browser’s publishers can do that. Here’s a list with the best browsers for Windows 10.

  • Some websites embed special code in their page scripts that disable the function of your browser’s back button preventing users from returning to pages they previously visited.

This article covers:Topics: