Javascript 为什么window.location.href不适用于我的谷歌扩展?

Javascript 为什么window.location.href不适用于我的谷歌扩展?,javascript,google-chrome-extension,Javascript,Google Chrome Extension,我正在创建一个Google扩展,并使用window.location.href将它们重定向到一个网站。前两行代码可以工作,但window.location.href不能。 我不知道如何解决这个问题,我被难住了 var reply = prompt("Please put in the clothings ID"); var idofreply = reply - 1; window.location.href = 'http://nbcasset.x10.bz/' + idofreply; 此

我正在创建一个Google扩展,并使用window.location.href将它们重定向到一个网站。前两行代码可以工作,但window.location.href不能。 我不知道如何解决这个问题,我被难住了

var reply = prompt("Please put in the clothings ID");
var idofreply = reply - 1;
window.location.href = 'http://nbcasset.x10.bz/' + idofreply;

此行不起作用:window.location.href=http://nbcasset.x10.bz/“+idofreply

你在哪里执行这个代码?在后台脚本中?是的,我是在后台脚本中完成的。