javascript - calling parent page function through content script in extension -
my webpage follows:
<body> <div class="row"> <button type="button" class="btn btn-primary" id="manual-dial" onclick="dial()";>dial</button> </div> </body> /* dial() function written in js of parent web page */
content.js follows:
var phone=document.getelementbyid("manual-dial"); phone.addeventlistener("click",dial, false);/*want call dial function of webpage*/ chrome.runtime.sendmessage(/*send response dial() background.js*/);
background.js
chrome.runtime.onmessage.addlistener(function(response,sender,sendresponse) { alert(response); });
i want call dial() function of web page extension. how can ?
Comments
Post a Comment