I am writing a userscript for a SPA site with client-side routing. I want to run code every time the URL changes (navigation of an SPA), but I do not know which window event to hook onto. The popstate event only works when the back button is used, which is not the case in an SPA.
            Asked
            
        
        
            Active
            
        
            Viewed 500 times
        
    0
            
            
         
    
    
        Epic Programmer
        
- 383
- 3
- 12
- 
                    1See [this answer](https://stackoverflow.com/a/39508954). In modern Chrome you can use `navigation` API. – wOxxOm Sep 07 '22 at 18:47