D
D
dollar2019-05-13 22:18:53
JavaScript
dollar, 2019-05-13 22:18:53

Why can't window.location.href be changed?

let url = chrome.runtime.getURL('options.html'); //валидный! проверено.
location.href = url; //белый экран

location.href='http://ya.ru'; //зато это работает без проблем

For some reason, you can't change the tab address to something like chrome-extension://blablabla
With the URL itself, everything is in order. If you arrange it as a link, even with target _blank, then when you click on the link - a white screen (about:blank), and if you right-click on the link and open the command in a new tab, then everything is fine.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Yarkov, 2019-05-13
@dollar

manifest.json has a web_accessible_resources section. Add options.html there.
But it's better to open the settings like this
chrome.runtime.openOptionsPage()

V
Vladimir Proskurin, 2019-05-13
@Vlad_IT

This is for security purposes. Even through command line options, you can't open service pages.
A quick Google search showed that through extensions it seems like it’s possible, but in a new tab.
(found here https://groups.google.com/a/chromium.org/forum/#!t... )

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question