Converting file:/// protocol to http://localhost during web development for testing purposes
As a developer working under his Localhost server before uploading a project to the WWW, I've encountered one issue (or a disturbance, so to speak) that somehow always takes away 3-4 seconds of my time and disturbs my workflow.
After opening a web document in Windows from Windows Explorer, whether if its an html file, PHP file or anything else, Google Chrome opens it under file:// protocol instead of http://, resulting in developers clicking on the address bar just to switch to http://localhost for testing purposes (Ajax/XHR requests etc).
After a while of doing that over and over and over again, I've decided to put an end to the countless clicks and backspaces, and created a Chrome Extension that does it for me.
It called Localhost Automate.
Localhost Automate provides an easier, more comfortable way to tell the browser to get the http://localhost up there instead of file://, as long as the web document is in the preconfigured folder.
Localhost Automate requires you to input a valid path to your localhost folder (ie. d:\wwwroot), so afterwards, if you're opening a file under 'd:\wwwroot\SomeProject', the extension would redirect it to 'http://localhost/SomeProject'.
The extension is here - link
And the Github Repo is here - link
Any suggestions/comments/issues are welcome. :)
Written by Tal Koren
Related protips
2 Responses
need a '/' after localhost in your javascript
Thank you stevensmann, I've updated my code thanks to your issue submission. :)
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside