2016-09-15 6 views
4

window.popstateが解雇されたときに新しいページのURLを取得する方法はありますか?window.popstateで新しいURLを取得

window.onpopstate(function(){ 
    newPageUrl = //get the new page's URL 
}) 
+0

はない 'location.href'仕事をしていますか? 。 –

+0

window.location.href.toString()スプリット(window.location.host)[1] –

答えて

3

使用この

window.onpopstate(function(){ 
    newPageUrl = location.href; 
}) 
+1

これは正しい構文である: window.onpopstate =関数(){ } https://で現像.mozilla.org/ja-jp/docs/Web/API/WindowEventHandlers/onpopstate – Marian07

関連する問題