繁体   English   中英

我的processing.js草图没有加载。 这不应该太难回答

[英]My processing.js sketch doesn't load. This shouldn't be too hard to answer

我想对我刚刚移植到processing.js的草图进行测试。 当我加载网页时,我从Chrome中的javascript控制台收到以下错误:

XMLHttpRequest无法加载file:///Users/aoeuaoeu/Desktop/projects/local%20site%20files/_/ee.pde。 Access-Control-Allow-Origin不允许使用null。 processing.js:27未捕获错误:NETWORK_ERR:XMLHttpRequest异常101

这是我正在加载的页面的来源:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Earnest Emporium</title>
<!--Contact: earnestemporium@gmail.com--> 
<script src="processing.js"></script>   
<canvas data-processing-sources="ee.pde"></canvas>  
</head>
<body>
</body>
</html>

ee.pde和processing.js与html文件在同一目录中,所以我不确定发生了什么。 我还应该指出,我正在本地测试这个,当我上传到我的ftp服务器上加载页面时出现了不同的错误。 (也许它是chrome?我得到一个黑盒子,一旦它上传到ftp服务器就不会出现在firefox上的chrome上。它在firefox本地工作正常)

 /processing.js:17946Uncaught SyntaxError: Unexpected token <
Processing.Sketch.attach/processing.js:17946
Processing.Processing.executeSketch/processing.js:16209
Processing/processing.js:16237
init/processing.js:17991
window.addEventListener.i

我刚注意到这一点:

file:///Users/aoeuaoeu/Desktop/projects/local%20site%20files/_/ee.pde.

你在桌面上运行吗? 如果我没有记错的AJAX 不会从你的桌面上运行,你需要一个本地Web服务器设置,并通过调用你的本地主机上运行它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM