开发者

Link from content script to options page

开发者 https://www.devze.com 2023-01-10 04:55 出处:网络
How to link to opt开发者_如何学运维ions page from content script?From API: Referring to extension files

How to link to opt开发者_如何学运维ions page from content script?


From API:

Referring to extension files

Get the URL of an extension's file using chrome.extension.getURL(). You can use the result just like you would any other URL.

So chrome.extension.getURL("options.html"); should do the trick.


just add to manifest.json

"web_accessible_resources": ["options.html"]

and this will work from contentscript.js

window.open(chrome.extension.getURL("options.html"));


This worked for me, for opening the options as a new tab:

chrome.tabs.create({
        url: "options/index.html"
})
0

精彩评论

暂无评论...
验证码 换一张
取 消