开发者

Link from content script to options page

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜