I'm trying to redirect the user to chrome://settings
(or this can be really any page with the chrome://
prefix) but window.location='chrome://settings'
or window.location='chrome://crash'
don't work. Any ways that do work?
.
Asked
Active
Viewed 124 times
0

talhoid
- 61
- 9
-
Is there an error in the console when you try this? – Barmar Nov 17 '20 at 17:42
-
You need quotes around the URL. – Barmar Nov 17 '20 at 17:42
-
@Barmar No, there is no error. I will put quotes around the URL. – talhoid Nov 17 '20 at 17:44
-
When I tried it I got the error "Not allowed to load local resource". – Barmar Nov 17 '20 at 17:46
-
2VM245:1 Not allowed to load local resource: You can see that in the console – Andre Nov 17 '20 at 17:47
-
@Barmar But can you fix that? – talhoid Nov 17 '20 at 17:48
-
For security reasons, you cannot do this. – gen_Eric Nov 17 '20 at 17:48
-
@RocketHazmat But does google say that anywhere? If so then comment a link. – talhoid Nov 17 '20 at 17:50
-
1The last thing Chrome wants is people from random websites asking people to "open this page and turn on Allow Intrusive Advertising". Wait, it's made by Google... – Heretic Monkey Nov 17 '20 at 17:51
-
@escr https://stackoverflow.com/a/40364397 – gen_Eric Nov 17 '20 at 17:51
-
@HereticMonkey Ah I see. So how do I close this question? – talhoid Nov 17 '20 at 17:52
-
@escr Also maybe https://developer.mozilla.org/en-US/docs/Mozilla/Gecko/Script_security – gen_Eric Nov 17 '20 at 17:53
-
You can just delete it. It's zero score. – Heretic Monkey Nov 17 '20 at 17:53
1 Answers
1
You cannot do this for security reasons. You can't open any local resources or browser's features pages, it could be potentially dangerous so it is blocked by default by browser.
For example, in Firefox trying to execute following code:
window.location = 'about:preferences'
leads to an error:
TypeError: Access to 'about:preferences' from script denied.
In chrome:
window.location = 'chrome://settings'
leads to:
VM388:1 Not allowed to load local resource: chrome://settings/

wjatek
- 922
- 7
- 22
-
I haven't checked yet but I assume this could be overwritten by through about:config settings (Firefox). Assuming it is possible would this create an attack vector where scripts can edit settings? Or would they only be able to open an local resources page (about:-page)?! – Albin Oct 27 '21 at 16:05
-
And in case it does not work by changing the security settings, would it be possible for an addon to open the "about:profiles" page? – Albin Oct 27 '21 at 16:05
-
But why would anyone do that? You can [open plugin's setting page](https://stackoverflow.com/questions/6782391/programmatically-open-a-chrome-plugins-options-html-page/28633663) and I think it is the only thing you need. There is another question similar to this one on [security stackexchange](https://security.stackexchange.com/questions/171572/why-cant-i-open-the-chrome-settings-page-from-javascript), but the answer is more or less the same. – wjatek Oct 28 '21 at 20:46
-
Does the way really matter in order to discuss the how? Other people might look for the same answer but for a very different reason. Anywho if it helps you to know my "personal reason" - currently there is no way to restart Firefox with a single click without auxiliary tools. But you can go through `about:preferences`, there is a restart button there. – Albin Oct 28 '21 at 21:10
-
So I'm trying to find a way to reach the page with as few unnecessary clicks and mouse movement as possible for everyone (see [here](https://superuser.com/questions/1283297/is-it-possible-to-quickly-restart-firefox-quantum-v57-or-up#comment2586417_1370866)) to replicate - one click would be the final goal. Or with my current solution: two clicks but without the necessity for a pinned tab. – Albin Oct 28 '21 at 21:11