最終更新:2014-02-05 (水) 12:13:53 (3704d)
Google Chrome/拡張機能/コンテントスクリプト
https://developer.chrome.com/extensions/content_scripts.html
- 対象ページを表示する際に,そのページのコンテキスト上でJavaScriptを実行
- サンドボックスみたいな感じで実行される(DOMにはアクセスできるけどJSの関数・変数とかは無理)
- 表示されたページのDOM操作とか
- バックグラウンドページとメッセージ通信を行える
"content_scripts": [ { "matches": ["http://www.google.com/*"], "css": ["mystyles.css"], "js": ["jquery.js", "myscript.js"] } ],
できないこと
- Use chrome.* APIs (except for parts of chrome.extension)
- メッセージングで間接的に実行可能
- Use variables or functions defined by their extension's pages
- Use variables or functions defined by web pages or by other content scripts