
Java
1.使用location.href属性:
window.location.class="url" target="_blank" rel="nofollow noreferrer" href="/to/?target=https://www.example.com";
2.使用location.replace方法:
window.location.replace("https://www.example.com");
3.使用location.assign方法:
window.location.assign("https://www.example.com");
这三个方法都可以让浏览器跳转到另一个页面。其中,使用location.replace方法和location.assign方法的区别在于,前者会替换当前浏览历史记录,而后者会生成新的浏览历史记录。
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号