簡體   English   中英

window.location.replace無法正常工作

[英]window.location.replace is not working

function setInit(){
    iu.init({
        saveFile : 'store/saveImageFile'
        ,CallBackOnSave : function (s){
            console.log("redirect");
            window.location.replace("store/details");
        }
    });
}

iu是圖像上傳模塊,沒有問題。 實際上,我可以看到redirect的控制台日志。

問題是,重新加載了同一頁面,而不是進入替換頁面中的URL。

也嘗試了其他方法,例如href ,同樣的結果。

只需使用:

window.location.href = "store/details";

也許嘗試:

parent.window.location.href = "store/details";

您可以通過這種方式使用

句法

window.location.href = window.location.host + relativePath 
window.location.href = relativePath

window.location.href = "store/details";
window.location.href = window.location.host + 'store/details';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM