Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use (or is it possible) MutationObserver to monitor window.location.pathname change?

Tags:

People also ask

How do you detect DOM change?

“MutationObserver” is a Web API provided by modern browsers for detecting changes in the DOM. By using this API you can listen to changes in DOM, like added or removed nodes, attribute changes or changes in the text content of text nodes and make changes.

Is MutationObserver slow?

Good answer! Yes, it's finally slower by just 10% or even less in recent versions of Chrome.

How do you stop MutationObserver?

disconnect() The MutationObserver method disconnect() tells the observer to stop watching for mutations. The observer can be reused by calling its observe() method again.


I wonder if it is possible to use MutationObserver to monitor change in window.location.pathname (or window.location.hash).