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

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -