That flag is dangerous!!
(那面旗子很危险!!)
Leaves your file system open for access.(使文件系统保持打开状态以便访问。)
Documents originating from anywhere, local or web, should not, by default, have any access to local file:/// resources.(默认情况下,源自任何地方,本地或Web的文档不应具有对本地file:///资源的任何访问权限。)
Much better solution is to run a little http server locally.
(更好的解决方案是在本地运行一个小的http服务器。)
--- For Windows ---
(---对于Windows ---)
The easiest is to install http-server globally using node's package manager:
(最简单的方法是使用node的包管理器全局安装http-server:)
npm install -g http-server
Then simply run http-server
in any of your project directories:
(然后只需在任何项目目录中运行http-server
:)
Eg.
(例如。)
d:\my_project> http-server
Starting up http-server, serving ./
Available on:
http:169.254.116.232:8080
http:192.168.88.1:8080
http:192.168.0.7:8080
http:127.0.0.1:8080
Hit CTRL-C to stop the server
Or as prusswan suggested, you can also install Python under windows, and follow the instructions below.
(或者如prusswan建议的那样,您也可以在Windows下安装Python,并按照以下说明操作。)
--- For Linux ---
(---对于Linux ---)
Since Python is usually available in most linux distributions, just run python -m SimpleHTTPServer
in your project directory, and you can load your page on http://localhost:8000
(由于Python通常在大多数Linux发行版中都可用,只需在项目目录中运行python -m SimpleHTTPServer
,然后就可以在http://localhost:8000
上加载页面了。)
In Python 3 the SimpleHTTPServer
module has been merged into http.server
, so the new command is python3 -m http.server
.
(在Python 3中, SimpleHTTPServer
模块已合并到http.server
,因此新命令是python3 -m http.server
。)
Easy, and no security risk of accidentally leaving your browser open vulnerable.
(简单,没有安全风险,意外地让您的浏览器易受攻击。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…