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

标签 javascript html redirect

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

我要将用户重定向到一个页面,我只想在浏览器完全重定向后执行某些操作(调用函数),但我无法让它工作。我有什么办法可以做到这一点吗?

最佳答案

Is there any way for me to do so?

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

关于javascript - 仅在浏览器完全重定向后才调用该函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4958790/

相关文章:

javascript - 具有完整日历的上下文菜单,在日历和上下文菜单之间传递数据

javascript - DOM 元素属性值可以是 JavaScript 对象吗?

html - 减少加载时间,或让用户认为加载时间更少

Windows命令行重定向下的c++换行符

javascript - 找出 Jquery ajax 请求被重定向到的位置

javascript - 在 php 页面上如何使用 mysql 在第 n 行之后插入行

Javascript (angularJS) : filter by multiple field

javascript - 视觉 : How to re-render view midway through event loop cycle?

javascript - CSS 中的表格尺寸在 HTML 中不起作用

wordpress - 在 htaccess 中将 http 重定向到 https 时出现问题