Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect what action causes page reload?

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.

like image 562
Qwertiy Avatar asked Feb 25 '16 18:02

Qwertiy


People also ask

How can you tell if a page is reloaded?

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.

How do you catch browser refresh event in react?

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!

How does react detect page refresh?

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.

Why do pages reload?

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.


1 Answers

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

like image 176
Kayce Basques Avatar answered Sep 28 '22 17:09

Kayce Basques