Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link from content script to options page

How to link to options page from content script?

like image 864
Tomasz Wysocki Avatar asked Aug 05 '10 18:08

Tomasz Wysocki


3 Answers

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.

like image 70
serg Avatar answered Nov 09 '22 21:11

serg


just add to manifest.json

"web_accessible_resources": ["options.html"]

and this will work from contentscript.js

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

like image 35
dhilt Avatar answered Nov 09 '22 20:11

dhilt


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

chrome.tabs.create({
        url: "options/index.html"
})
like image 5
xdumaine Avatar answered Nov 09 '22 20:11

xdumaine