我正在开发一个Chrome扩展。 我有一个requiremen是创建一个新的选项卡与像JavaScript'窗口'功能的一些参数。如何创建开发Chrome扩展的chrome选项卡,比如window.location?
默认情况下,javascript窗口的功能,我需要设置下面的代码,然后window.location.replace
允许在新窗口中访问页面的权限。
window.name = JSON.stringify({
id : 'tmp',
companyCode : companyCode,
locationCode : locationCode,
terminalNo : terminalNo,
terminalKey : terminalKey,
server:{
protocol : protocol,
remoteHost : remoteHost,
remotePort : remotePort,
clientHost : clientHost,
localPort : clientPort,
webContext : null,
gcRemoteHost : remoteHost,
gcRemotePort : remotePort,
soaPort: 9091,
webSocketPort : 9099,
}
});
现在,我正在使用谷歌浏览器api创建选项卡。
chrome.tabs.create({
url: new_location
});
所以,我有一个问题,我应该如何通过上述window.name
创建我可以访问新位置的新标签。
new_location是web网址,在允许我访问网站之前,它需要准确接收window.name的值。是否有可能在创建chrome选项卡时模拟window.name – tommychoo
相关:[将参数传递给使用chrome.tabs.executeScript()注入的内容脚本](// stackoverflow.com/q/17567624) – Makyen