仅在浏览器完全重定向后调用该函数?

Tei*_*eiv 0 html javascript redirect

<script>
function test() {
    alert("this should only be called after the browser is fully redirected?");
}
window.location = "http://google.com";
test();
</script>
Run Code Online (Sandbox Code Playgroud)

我是要将用户重定向到一个页面,我想在浏览器完全重定向后才能做某事(调用一个函数),但我无法让它工作.我有什么方法可以这样做吗?

Pek*_*ica 5

我有什么方法可以这样做吗?

不.页面打开后google.com,您将无法再控制浏览器窗口.