javascript - Chrome extension: Open html in the crx file with no icon on tab -


hi developing simple chrome extension substitutes current default new tab page opening index.html in extension's .crx directory.

currently new tab page has been modified new index.html page, however, there no icon on tab.

may ask why? much!

current problem new tab page opened no icon on tab

current problem

the extension directory looks this:

directory

code of manifest.json follows

{     "manifest_version": 2,       "name": "千山",       "version": "0.1.0",       "description": "测试",      "icons": {"16": "icon200.png", "48": "icon200.png", "128": "icon200.png"},     "browser_action": {           "default_icon": "icon.png" ,         "default_title": "测试",         "default_popup": "popup.html"     },     "chrome_url_overrides": {         "newtab": "index.html"     } } 

head of index.html follows , wrote did not show up

<!doctype html> <html lang="zh-cn">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">      <title>千山</title>     <!-- bootstrap -->     <link href="bootstrap.min.css" rel="stylesheet">     <link rel="icon" href="fav.ico" type="image/x-icon"> 

you need replace relative path "fav.ico" full extension path of file. in javascript can full path calling chrome.runtime.geturl("fav.ico").

if know full path , take precautions make sure id of extension not change on time (by publishing using same key.pem file), hard-coding path work , won't require javascript.

you may need add "fav.ico" web_accessible_resources part of manifest.json:

{     "web_accessible_resources": [         "fav.ico",         "bootstrap.min.css"     ] } 

Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -