Hi
Now i try call function by events.
In my web page is:
function WybierzPlik()
{
window.postMessage({ type: "ELDOK_EXT_MSG", params: "UruchomWybierzPlik()" }, "*");
}
in my content script :
window.addEventListener("message", function(e) {
alert('aaaa');
if (e.source != window) {
return;
}
var data = JSON.parse(e.data);
if (data.type && (data.type == "ELDOK_EXT_MSG")) {
UruchomWybierzPlik();
}
});
My manifest :
{
"name": "Plugin el-Dok",
"description": "Plugin el-Dok",
"version": "0.7",
"background": { "scripts": ["background.js"], "persistent": false },
"content_scripts":[{
"matches": [ "*://*/*" ],
"js": [ "jquery-2.1.4.min.js", "content.js" ],
"run_at": "document_idle"
}],
"content_security_policy": "script-src 'self'; object-src 'self'",
"description": "Komponenty dla el-Dok System ",
"manifest_version": 2,
"permissions": [ "nativeMessaging","tabs" ,"activeTab", "management" ],
"externally_connectable": {
"matches": ["*://*.
eldok.pl/*","*://localhost/*" ]
}
}
But addEventListener don't start. Where is the problem?