如何解决书签不会重定向
我正在尝试制作一个书签,它将使我登录到画布并在加载后进入缩放页面
这是我的代码:
This will log in the user into canvas | V javascript:void(location.href='https://pccsk12.instructure.com/login/saml');
setTimeout(()=>{void(location.href='https://pccsk12.instructure.com/courses/9645/external_tools/184');},10000); ^ | This will switch to the zoom page after everything has loaded
但是它不起作用。它已登录,但10秒后未重定向。 我的代码有什么问题?
解决方法
首次使用location.href
切换页面时,它将导航到新页面并卸载当前所有正在运行的Javascript,包括超时。您可以尝试使用window.open
在新标签页中打开登录页面,以免覆盖当前标签页。看起来像这样:
javascript:(function(){
var login = window.open('https://pccsk12.instructure.com/login/saml');
setTimeout(() => {login.location.href = 'https://pccsk12.instructure.com/courses/9645/external_tools/184';},10000);
})();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。