如何重定向到一个书签URL在crossrider

How to redirect to a bookmark URL in crossrider?

本文关键字:书签 一个 URL crossrider 重定向      更新时间:2023-09-26

在crossrider中,我在后台代码中设置了一个函数

function buttonClick() {
  alert(2);
  // simulates similar behavior as an HTTP redirect
  var url = "http://12bubbles.com";    
  window.location.replace(url);
}

安装扩展后,当buttonClicked()被调用,alert()确实弹出,但重定向不起作用。我的代码有问题吗??

终于想通了。如果有人面临同样的问题,我只能使用自己的API

function buttonClick() {
      alert(2);
      // simulates similar behavior as an HTTP redirect
      var url = "http://12bubbles.com";    
      appAPI.openURL(url, "current");
    }

试试window.location.href = url;

window.location.href = url; 

是正确的语法