Chrome.webNavigation Undefined
Answer :
On top of @rsanchez answer, if you call a chrome.webNavigation
in the background script of your extension, but still have this error, you may also need to add the webNavigation
permission in your manifest.json
.
"permissions": [ "webNavigation" ]
Mozilla documentation | Chrome Documentation
chrome.webNavigation
, as most chrome.* APIs, can only be accessed from the background script of an extension, not from content scripts. Although your file is named background.js
, your manifest shows that you are using it as a content script.
It is right to use a content script in this case because you need to interact with the DOM. From the fragment of code you posted, it seems that you don't need to use the webNavigation API. You can simply set your content script in your manifest to run_at: document_end
, and it will run as soon as the DOM is complete. Check http://developer.chrome.com/extensions/content_scripts.html
Comments
Post a Comment