I'm having an html file somewhere placed on my computer for example file:///C:/Users/index.html

Is it possible to manipulate that URL (using code inside that file) in a Browser which opened the file? I don't want to redirect to another homepage or something like this.

I found this solution to update the URL with javascript for domains but only its path. I can't get anything to work for my local path and it's not really what I was searching for.

  • It is a mistake to expect web like behaviours while not using a web server. Why are you not using a web server? Apache is light and easy to install. I even run it on my HP mini with millions of web pages. – closetnoc Oct 5 '17 at 17:05
  • FILE:// is a system file protocol which can not be rewritten the same way as a URL from a HTTP:// protocol can. Download XAMP if you want pretty URLS – Simon Hayter Oct 6 '17 at 0:02
  • See on Chrome's bug tracker: history.pushState & history.replaceState on file:/// URLs – Stephen Ostermiller Oct 6 '17 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.