I realized we can work at shared DOM (according to manual) from content scripts.
We can connect injected DOM content with our Content Scripts via
element.addEventListener('click',function(){ ourController.fnCallback(); });
// or
element.onclick = ourController.fnCallback;
But when injected DOM implements something like this:
<a href="javascript:ourController.fnCallback();">Click Me!</a>
thrown error is cannot call fnCallback() on undefined ourController (not exactly rewritten error messages)
Is there aby way we can communicate with our javascript object from injected dom like i tried in second example?
Object is defined in content_script.js like this:
var ourController = {
fnCallback: function(){
// code here
}
};
and this code is placed directly in script loaded according to manifest like this:
"content_scripts": [ {
"js": [ "content_script.js" ],
"matches": [ "http://*/*", "https://*/*", "ftp://*/*" ],
"run_at": "document_start"
}],