我認爲這將是一個經常問到的問題,但我無法找到答案。 有沒有一種方法可以讓Chrome瀏覽器擴展程序的瀏覽器操作彈出窗口僅在content_scripts匹配頁面上可用?僅在「content_script」上激活的瀏覽器操作匹配
例如:我爲網站做了擴展。我希望彈出窗口僅在瀏覽網站時可用(在當前選項卡上)。我該怎麼做?
對於我來說,默認情況下瀏覽器操作始終處於啓用狀態,無論我正在瀏覽哪個頁面,頁面操作都未啓用。
感謝您的幫助
編輯:這裏是清單的一部分,我沒有成功pageAction改變。我希望我的圖標僅在瀏覽LDLC的標籤上激活。
{
"content_scripts": [
{
"js": [ "jquery.min.js", "scrooge.js" ],
"matches": [ "*://www.ldlc.com/fiche/*", "*://ldlc.com/fiche/*" ]
}],
"manifest_version": 2,
"permissions": [ "storage", "activeTab","*://ldlc.com/*", "*://scroogealpha.esy.es/*" ],
"page_action": {
"default_title": "Worth buying?", // optional; shown in tooltip
"default_popup": "popup.html" // optional
},
"web_accessible_resources": [
],
"background":{
"scripts" : ["eventPage.js"],
"persistent": false
}
}
請參閱[declarativeContent API](https://developer.chrome.com/extensions/declarativeContent)。 – wOxxOm