Search code examples
javascripthtmlbrowser-history

Prevent Browser from saving an URL


My Website shows for two seconds a "Loaded!" at the start of the URL path (site.com/Loaded!/forums) without reloading the page

The problem is that the browser is currently saving the "fake" link in the history: History

Is there any way to prevent the browser to save this link?


Solution

  • Your page has code:

     if (_timer) clearInterval(_timer);
        window.history.pushState('', 'MineLight', "Loaded!/" + Url);
        setTimeout(Back, 2000);
    

    window.history.pushState:

    HTML5 introduced the history.pushState() and history.replaceState() methods, which allow you to add and modify history entries, respectively. These methods work in conjunction with the window.onpopstate event.

    You must delete it.

    Adding and modifying history entries