2021年1月27日星期三

Open a new tab .html on click Chrome extension, page not show when using vue

background.js

 chrome.browserAction.onClicked.addListener((tab)=>{        chrome.tabs.create({          url : chrome.runtime.getURL("index.html")        })      })  

manifest.js

{    "manifest_version": 2,    "homepage_url": "http://localhost:8080/",    "name": "Somename",    "description": "Some description",    "version": "1.0",    "browser_action": {      "default_icon": "icon.png"    },    "icons": {      "128": "icon.png",      "48": "icon.png",      "64": "icon.png"    },    "background": {      "scripts": ["background.js"],      "persistent": false    },    "permissions": [      "activeTab",      "storage",      "bookmarks",      "*://*/*",      "<all_urls>"    ],    "web_accessible_resources": [      "*.html",      "images/*.gif",      "images/*.png",      "*.js"    ]  }  

index.html

<!DOCTYPE html>  <html>    <head>      <meta charset="utf-8">      <meta name="viewport" content="width=device-width,initial-scale=1.0">      <title>chrome-extesion-bookmark_robot</title>    </head>    <body>      Injected???      <div id="app"></div>      <!-- built files will be auto injected -->    </body>  </html>  

localhost:80 hold by nginx: enter image description here

chrome extesion index.html: enter image description here

When I click the extesion, open a new tab with nothing. But when I setup a nginx and set location root folder dist, go to url localhost:80 showing well.

https://stackoverflow.com/questions/65929952/open-a-new-tab-html-on-click-chrome-extension-page-not-show-when-using-vue January 28, 2021 at 09:54AM

没有评论:

发表评论