1

在 crossrider 中,我在后台代码中有一个函数

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

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

4

3 回答 3

7

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

function buttonClick() {
      alert(2);
      // simulates similar behavior as an HTTP redirect
      var url = "http://12bubbles.com";    
      appAPI.openURL(url, "current");
    }
于 2011-07-20T06:18:56.290 回答
1

尝试window.location.href = url;

于 2011-07-19T17:12:39.110 回答
1
window.location.href = url; 

是正确的语法

于 2011-07-19T17:14:24.253 回答