I have the following code in my content script which is calling a function in the webpage's javascript
var actualCode = '(' + function() {
functionInMyWebPage();
}
+ ')();';
var script = document.createElement('script');
script.textContent = actualCode;
(document.head||document.documentElement).appendChild(script);
script.parentNode.removeChild(script);
This is working and it fires the functionInMyWebPage() function.
Now I need to get the returned value of this functionInMyWebPage() and call another function which defined in the content script itself. If I call it in the above script block it will complain as it has not defined.