如何重定向到 Crossrider 中的书签 URL?
在 crossrider 中,我在后台代码中有一个函数,
function buttonClick() {
alert(2);
// simulates similar behavior as an HTTP redirect
var url = "http://12bubbles.com";
window.location.replace(url);
}
安装扩展后,当调用 buttonClicked() 时,alert()
确实弹出,但重定向不起作用。我的代码有问题吗?
In crossrider, I've a function in the background-codes as
function buttonClick() {
alert(2);
// simulates similar behavior as an HTTP redirect
var url = "http://12bubbles.com";
window.location.replace(url);
}
After installing the extension, when buttonClicked() is called, the alert()
did pop up but the redirect doesn't work. Is something wrong with my codes??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
终于想通了。如果有人面临同样的问题,我只能使用他们自己的 API
Finally figured out. If anyone is facing the same problem, I simple had to use their own API
尝试
window.location.href = url;
Try
window.location.href = url;
是正确的语法
is the proper syntax