Search code examples
google-chromebrowsercommand-lineurldecode

How to prevent URL encode when opening local URL with google-chrome command?


For example, when I type the following:

google-chrome https://somewebsite.com/somepage/#someheading

It will open the exact URL (without encode) in the browser.

But when I try to open from local file:

google-chrome ~/localdirectory/index.html#someheading

It will open the following:

file:///home/imampt/localdirectory/index.html%23someheading

Which will result in "Your file was not found".

The following command works, however:

google-chrome ~/localdirectory/index.html

How to open a local URL without encoding from the command line?


Solution

  • Somehow appending file:// as prefix to the URL solve the issue for me:

    google-chrome file://$HOME/localdirectory/index.html#someheading