0

你能請讓我知道我可以添加一個jQuery插件爲谷歌Chrome擴展manifest.json文件?如何jQuery插件添加到Chrome擴展的manifest.json

{ 
    "manifest_version": 2, 

    "name": "One Pass", 
    "description": "This is a Development.", 
    "version": "1.0", 

    "browser_action": { 
    "default_icon": "icon.png", 
    "default_popup": "popup.html" 
    }, 
    "permissions": [ 
    "https://secure.flickr.com/" 
    ] 
} 

感謝,

回答

3

您需要將其添加爲內容腳本。它在鉻合金中有很好的記錄:http://developer.chrome.com/extensions/tut_migration_to_manifest_v2.html。最簡單的方法是保留jquery的本地副本並將其與擴展一起發送,然後在manifest.json中將其引用,如下所示:

"content_scripts": [ 
    { 
    "all_frames": false, 
    "matches": ["<all_urls>"], 
    "exclude_matches": [], 
     "js": [ 
     "js/lib/jquery.js" 
     ], 

     "css": [ 
     "js/content/page.css" 
     ] 
    } 
    ] 
相關問題