Most of the time, loading HTML files from the filesystem (with the
Every once in awhile, though, you might run into a situation for which the file:// protocol is ill-suited — specifically, if/when you run into an error like this:
Cross origin requests are only supported for HTTP.
In other words, I ran into this really cool snippet:
$ cd /home/somedir $ python -m SimpleHTTPServer
... awhile ago, and needed it a couple of minutes ago, and could barely remember it (hat tip to LinuxJournal for being easily Googleable). So I'm posting it here for posterity, and to augment my clearly failing memory.
Running that command will make, by default, the
/home/somedir accessible at
Or you can pass in the preferred port (
python -m SimpleHTTPServer 8080) into the command line instead.
Thumbs up. Onward!
- Also useful: tying this sort of thing to something like localtunnel, to brainlessly / painlessly broadcast something on your local machine to the interwebs.
Let me know what you think on Twitter.