1
我對js和chrome擴展非常新,並且試圖創建一個擴展名,它獲取當前標籤url並在最後添加'& flash = on'。我的代碼似乎並不想工作的權利Chrome擴展程序獲取URL並追加結尾
manifest.json
{
"name": "FlashOn Chrome",
"version": "0.1",
"description": "Changes default to flash player",
"permissions": [
"tabs"],
"content_scripts": [
{
"matches": ["http://www.stream.com/*"],
"js": ["script.js"]
}
]
}
script.js
function updateUrl(tab){
var currentURL = tab.url
var newurl = currentURL.replace(currentUrl + "&flash=on");
chrome.tabs.update(tab.id, {url: newurl});} chrome.browserAction.onClicked.addListener(function(tab) {updateUrl(tab);});
其爲具有HTML5視頻和Flash視頻,但閃存中的流媒體網站只是通過增加閃光燈& =到URL
結束訪問