JavaScript 和 jQuery 跳转页面的方法有很多种,下面整理了几个:
1、利用 http 重定向进行跳转:
window.location.replace("https://www.w3h5.com");
2、使用 href 进行跳转
window.location.href = "https://www.w3h5.com";
3、使用 jQuery 的属性替换方法
// 方法一
$(location).attr('href', 'https://www.w3h5.com');
// 方法二
$(window).attr('location','https://www.w3h5.com');
// 方法三
$(location).prop('href', 'https://www.w3h5.com')
声明:本文由w3h5原创,转载请注明出处:《JavaScript和jQuery自动跳转到另一个页面的方法》 https://cloud.tencent.com/developer/article/1537367
(adsbygoogle = window.adsbygoogle || []).push({});