You can detect when a page has loaded by using the window.onload () event. Why does my JavaScript code receive a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error, while Postman does not? Try with cookie. Happy Learning! How to print and connect to printer using flutter desktop via usb? but 99% of the time i get time measurements of 0.00 or 0.01 even if it takes longer. 0 - Page loaded due to link Why is this answer so popular? Polling is the best way if I dont know when my script is being injected. readyState === 'complete') { clearInterval( interval); done(); } }, 100); Otherwise it is assumed to be a fresh load. Thanks for contributing an answer to Stack Overflow! This method is simple, on load check flag - if flag not exist this is first load, else set the flag: Save flag in local-storage / cookie. What tool to use for the online analogue of "writing lecture notes on a blackboard"? If the name cookie matches the name of the page and the time cookie differs by the current time by no more than 5 seconds, then the load is assumed to be a refresh. simple and easiest way from JS. Difference between var and let in JavaScript, Convert a string to an integer in JavaScript. Give the name of your application as "Page_load_Time" and then click "Ok". Heres a document with