2017-02-16 95 views
-2

我有問題。例如,使用jQuery我打開網站。代碼location.href = "https://somesite.com";。在重定向之後,我可以從站點刪除一些元素,或者在此代碼location.href = "https://somesite.com";之後向腳本添加一些元素?jQuery重定向後做一些代碼

+0

dupes:http://stackoverflow.com/questions/18048338/how-can-i-execute-a-script-after-calling-window-location-href | http://stackoverflow.com/questions/37716183/execute-a-function-after-changing-location-href – lukkea

+0

[更改location.href後執行函數]的可能重複(http://stackoverflow.com/questions/ 37716183/execute-a-function-after-changing-location-href) – lukkea

+2

[如何在調用window.location.href後執行腳本?](http://stackoverflow.com/questions/18048338/how -can-i-execute-a-script-after-calling-window-location-href) – Finwe

回答

-2

不。當瀏覽器使用location.href = 'XYZ'離開頁面時,您的代碼根本就沒有被卸載。此外,same-origin policy應該防止你想要做的事情。

你可以爲你的網頁瀏覽器編寫一個插件來實現你的目標。

+0

-1 - 這是一個明顯的重複;儘量不要通過回答來鼓勵。除了說「不」之外,你還沒有真正回答過這個問題。您已將「在此輸入鏈接描述」作爲鏈接文本。 – lukkea

+0

修復鏈接:-) –