1、适用于Unix/Linux/Mac系统的基于python的web服务器
(1)进入代码所在的目录:cd /..
(2)在指定目录运行:> python -m SimpleHTTPServer
默认启动本地8000端口
2、基于NPM的web服务器
如果已经使用node.js,则肯定已经安装了NPM。使用NPM有两种方式可以搭建本地web服务器:
第一种:
使用http-server模块:
>npm install -g http-server
>http-server
默认启动本地8080端口
第二种:
使用simple-http-server:
>npm install -g simple-http-server
>nserver
默认启动:http://loacalhost:8000
3、禁用Firefox和Chrome的安全性检测——可以直接运行本地html文件
启动浏览器方式:
Windows系统: chrome.exe –disable-web-security
Linux系统:google-chrome –disable-web-security
Mac OS系统: open -a Google\ Chrome –args –disable-web-security