js刷新頁面問題

最近碰到一個問題:在js中使用
        window.location=window.location
刷新頁面的時候會出現做完幾步操作以後刷新頁面的按鈕失效的情況.經排查是url後面的"#"在作祟.
解決方法
    function refreshThisWindow() {
        
var str = window.location.toString();
        
if (str.lastIndexOf('#'!= -1{
            str 
= str.substring(0, str.length-1);
        }

        window.location
=str;
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章