禁止网页自动跳转:JS脚本示例
以下是禁止网页自动跳转页面的 JavaScript 脚本:
// 禁止网页自动跳转页面
window.onload = function() {
setTimeout(function() {
if (location.href.indexOf('http') !== -1) {
location.href = location.href;
}
}, 1000);
};
这个脚本会在页面加载完成后,延迟 1 秒执行。如果当前页面的 URL 中包含'http',则会将页面跳转到当前页面的 URL,从而禁止自动跳转。
原文地址: https://www.cveoy.top/t/topic/goqV 著作权归作者所有。请勿转载和采集!