Override window.location and determine if the location is overridden

  • 2020-03-30 03:54:49
  • OfStack

Under IE, window.lcoation can be overwritten without redirection. The specific method is: var location = {}, and then the specific property can be overwritten, which will bring some risks to judge location by js.
How do I tell if the location has been rewritten? After a rough afternoon, a rough way out:


(location==document.location&&location instanceof Location)

This method is only used for IE.


Related articles: