我正在開發一個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