0

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? .

talhoid
  • 61
  • 9

1 Answers1

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