How to Auto-refresh page once only after the first load Using Javascript Using window.onload: //add this js script into the web page, //you want reload once after first load window.onload = function() { //considering there aren't any hashes in the urls already if(!window.location.hash) { //setting window location The window.onload function is widely supported by popular browsers. If it returns false, then you know that this is the initial page load. To learn more, see our tips on writing great answers. Analyze your performance with iPhones, iPads, Samsung Galaxy/Note, Google Nexus/Pixel phones, and other popular devices. The onload event can also be used to deal with cookies (see "More Examples" below). I cant count on an event listener. Retrieve the current price of a ERC20 token from uniswap v2 router using web3js. Instead of that kind of performance.now() subtractions the code get little shorter by User Timing API where you set marks in your code and measure between marks. If we have a script after the style, then that script must wait until the stylesheet loads: The reason for this is that the script may want to get coordinates and other style-dependent properties of elements, like in the example above. Help to translate the content of this tutorial to your language! Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. it surely still can be improved, but this was good enough for me for now: Yep, that worked for me. However, if the poster doesn't know basic Javascript, I doubt he knows jQuery. How to detect page load without javascript? Asking for help, clarification, or responding to other answers. The tool will immediately run tests across the most frequently used browsers, devices, and operating systems. Happy Learning! Verify the element at the top left most corner has been shown. This returns a loading state while the document is loading. While using W3Schools, you agree to have read and accepted our, , ,