I have iframe loaded on a web page. Is it possible to call function in an iframe of parent webpage from extension ?
have done all-frames:true in manifest.json
iframe.html
as follows:
<body>
<div class="row">
<button type="button" class="btn btn-primary" id="manual-dial" onclick="dial()";>DIAL</button>
</div>
</body>
content.js
as follows:
/* cnt access frame id */
chrome.runtime.sendMessage(window.parent.frames[1].document.id);
window.parent.frames[1].document.id.onload = function() {
// want to call dial() of iframe
chrome.runtime.sendMessage("this is my response");
}
background.js
chrome.runtime.onMessage.addListener(function(response,sender,sendResponse) {
alert(response);
});