"Not allowed to load local resource: chrome://favicon/" -
im trying load url's favicon using chromes favicon url:
<img class='icon' src='chrome://favicon/yahoo.com' />
but im getting error :
"not allowed load local resource: chrome://favicon/yahoo.com"
and in manifest have:
"permissions": [ "chrome://favicon/" ],
there isnt much available online topic. suggestions?
problems in code "permissions": ["chrome://favicon/"]
, invalid pattern in manifest file
if want utilize url of tab's favicon
utilize chrome.tabs api in extension pages.
registered background page , added necessary permissions.
{ "name": "fav icon", "description": "http://stackoverflow.com/questions/14800881/not-allowed-to-load-local-resource-chrome-favicon", "version": "1", "manifest_version": 2, "background": { "scripts": [ "background.js" ] }, "permissions": [ "tabs", "<all_urls>" ] }
background.js chrome.tabs.query({ "active": true,//fetch active tabs "currentwindow": true,//fetch tabs in current window "status": "complete",//fetch loaded windows "windowtype": "normal"//fetch normal windows }, function (tabs) { (tab in tabs) { console.log(tabs[tab].faviconurl);// utilize url needed } });
chrome.tabs.query work in extension pages, if want utilize in content scripts utilize message passing communicate url.
references chrome.tabs api message passing google-chrome-extension
No comments:
Post a Comment