[Chrome Extension Javascript API] chrome.identity module fails to load in content scripts
Reported by
dimudesi...@gmail.com,
Jan 12 2017
|
||
Issue descriptionChrome Version : 55.0.2883.87 OS Version: 10.0 URLs (if applicable) : What steps will reproduce the problem? 1. Create a manifest file with the 'identity' permission set. 2. Create a content script the calls a function on the 'chrome.identity' module. 3. Load the un-packaged extension and test. 4. Open dev console, and inspect 'chrome' namespace object - identity module is non-existent. What is the expected result? The ability to call the methods on the chrome.identity javascript module from within a content script without error. What happens instead of that? TypeError reported in the console with "chrome.identity" undefined. Please provide any additional information below. Attach a screenshot if possible. See attached test extension (zipped or packed .crx). UserAgentString: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
,
Jan 12 2017
As you can see in the documentation, only a limited set of chrome.* API is available in content scripts: https://developer.chrome.com/extensions/content_scripts
,
Jan 12 2017
Just read that bit myself (after hour of looking for a solution that would work with a content script). I've discovered that I have to use the messaging mechanism to access the identity api from a background script.
,
Jan 12 2017
If there are any admins around, feel free to delete this item.
,
Jan 13 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by dimudesi...@gmail.com
, Jan 12 201712.0 KB
12.0 KB Download
24.5 KB
24.5 KB Download
1.7 KB
1.7 KB Download