开发者

Local development using HTML5 storage

I am experimenting with HTML5 local storage functionality, but was frustrated 开发者_JS百科to learn that the browser won't allow local storage when the file is local. My guess is that the browser (Chrome in my case, FF too) wants to see a domain rather than a file location. Has anyone here discovered a workaround for developing locally? Perhaps setting up a local domain? That sounds like too much trouble. There should just be a developer option in the browser, grrrrrr.


You'll find that most web developers will set up a local web server, as it's the only way to work locally with server-side scripts—anything written in PHP, ASP.NET, Python, etc. which includes pretty much all content management systems. It's actually not too difficult, either. On Linux, just install Apache using your package manager (sudo aptitude install apache2 on Ubuntu). On Mac OS, you already have one installed—just turn Web Sharing on in System Preferences > Sharing and then navigate to http://localhost/~YourUsernameHere/. On Windows, I'd recommend installing the Apache HTTP Server if you just want a web server, or XAMPP if you want MySQL, PHP and Perl (which are great for server-side development) installed as well with minimum fuss.


How about using Python as a lightweight server, go to your working directory and:

python -m SimpleHTTPServer

See http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜