My Chrome extension has a content script that uses the following to inject HTML into the page:
var optionsUrl = chrome.extension.getURL("src/options/options.html");
var content = '<a href="' + optionsUrl + '" target="_blank">Options</a>';
This produces:
<a href="chrome-extension://gdocgfhmbfbbbmhnhmmejncjdcbjkhfc/src/options/options.html" target="_blank">Options</a>
When I click the link, it opens a new browser tab and nothing more.
If I paste the href attribute chrome-extension://gdocgfhmbfbbbmhnhmmejncjdcbjkhfc/src/options/options.html
into the address bar, I see the options page for my Chrome extension displayed correctly.
- Why doesn't the link work?
- Is there some extra permission that I'm missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…