Unknown script action (probably async) causes page reload.
How can I find this action in the code?
At least, is there any way to set breakpoint on access to window.location
?
But I'm not sure that navigation is forced in such way.
In fact I need a way working in any one browser as page reloads in any of them.
PS: Same question in Russian.
A better way to know that the page is actually reloaded is to use the navigator object that is supported by most modern browsers. It uses the Navigation Timing API. thanks buddy this is accurate solution to detect either the page is reloaded from right click/refresh from the browser or reloaded by the url. Be aware.
If set to true, the browser will do a complete page refresh from the server and not from the cached version of the page. import React from 'react'; function App() { function refreshPage() { window. location. reload(false); } return ( <div> <button onClick={refreshPage}>Click to reload!
You can check the REDUX or CONTEXT state variables. When the user refreshes the page it reset the CONTEXT or REDUX state and you have to set them manually again. So if they are not set or equal to the initial value which you have given then you can assume that the page is refreshed.
By default, if it's using a lot of memory, Chrome purges the contents of some background tabs from RAM to conserve system resources. When you click back onto those tabs, the browser has to reload them because they have been erased from memory.
Try opening the Network panel, enabling Preserve log (which saves the network activity log between page loads) and then recreating the behavior.
https://stackoverflow.com/a/25734475/1669860
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With