I want to call function in my chrome extension from my web site but i dosn't work.
My web site:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<script>
function skan()
{
var editorExtensionId = "mfiphnfecnfhmhbfnnoicdnbcdacakpf";
// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, {Open: 'tekst'},
function(response) {
// if (!response.success)
alert(response)
});
}
</script>
<body>
<button onclick="skan()">Skan</button>
</body>
</html>
My extension code:
background.js
chrome.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse) {
// don't allow this web page access
if (request.Open)
alert(request.Open);
});
manifest.json
{
"name": "test",
"description": "test",
"version": "0.7",
"permissions": [
"debugger"
],
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "icon.png",
"default_title": "test"
},
"manifest_version": 2
}
When i call from webpage response is undefined. Event isn't call in chrome extension .Id extension is correct.
Where is problem. Thanks