When browsing a website is there any way to detect whether it's client-side routing or server-side routing in use, except for checking the network tab (in dev tools) for downloaded HTML documents?
            Asked
            
        
        
            Active
            
        
            Viewed 252 times
        
    1
            
            
        - 
                    Yeah, the network tab? – Jonas Wilms Sep 01 '19 at 19:00
 - 
                    What is "server-side" and what is "client-side"? You mean full reload vs adding part of HTML into DOM? – Akxe Sep 01 '19 at 19:01
 - 
                    @Akxe Yes, exactly. https://stackoverflow.com/a/10473302/1417223 – Fellow Stranger Sep 01 '19 at 19:16
 
1 Answers
-1
            
            
        You could use the beforeunload event to decide what type of routing that is.
window.addEventListener('beforeunload', function (e) {
  console.log(e);
  // This is usually used to block user navigation, for example, when they have not saved cahnges
  /**
   * // Cancel the event
   * e.preventDefault();
   * // Chrome requires returnValue to be set
   * e.returnValue = '';
   */
});
To detect changes to DOM, you could use MutationObserver. But I would either useone or the other.
        Akxe
        
- 9,694
 - 3
 - 36
 - 71