简体   繁体   中英

Log changes in window.location

Communication between Sketchup and their webdialogs is done by using window.location = skp:action@value to trigger a callback on the Sketchup. While doing so, it doesn't load another page, which this question uses.

Is there a way to extend window.location to log changes to the console when it doesn't load a new page?

you can try the hashchange event that fires when a window's hash changes

https://developer.mozilla.org/en/docs/Web/API/WindowEventHandlers/onhashchange

window
  .addEventListener("hashchange", function(event){
    console.log(event.newURL); //document.URL
  }, false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM