google chrome - How to inject content script inside an html page which runs within an extension -
i have created chrome extension contains 2 html pages background.html
, helper.html
.
i trying inject code helper.html
runs of course inside extension. helper.html
runs popup
window created chrome.windows.create(object createdata, function callback)
. however, far unable so. documentation understand content script rule should
"content_scripts": [ { "matches": ["chrome-extension://*/*"], "js": ["jquery.js","myscript.js"], "css": ["style.css"], "run_at": "document_end" }
but fails.
note when use localhost instead, example
"content_scripts": [ { "matches": ["http://localhost/"], "js": ["jquery.js","myscript.js"], "css": ["style.css"], "run_at": "document_end" }
it works. localhost runs exact same code somehow extension refuses recognize file trying match ( "matches": ["chrome-extension://*/*"]
)
chrome extensions can't inject content scripts chrome extensions.
you'll want use message passing instead.
Comments
Post a Comment