I have a manifest.json file that looks like this:
{ "name": "Zend Debugger Extension", "version": "0.1", "background_page": "background.html", "permissions": [ "cookies", "tabs", "http://*/*", "https://*/*" ], "browser_action": { "default_title": "Launch Zend Debugger", "default_icon": "icon.png", "popup": "popup.html" } }
Here is my background.html :
<html> <script> function testRequest() { console.log("test Request received"); } </script> </html>
And my popup.html :
<script> function debug(target) { if (target.id == 'thisPage') { console.log('sending request'); chrome.extension.getBackgroundPage().testRequest(); } } </script> <div onclick="debug(this)" id="thisPage">Current Page</div>
However, the background.html page is not available. I get this error:
Uncaught TypeError: Cannot call method 'testRequest' of null
When I check chrome.extension.getBackgroundPage() , I get a null value. I think I made a mistake in the manifest file, but I donβt see what I did wrong.
Thanks.
Antbrown
source share