Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I wanted to run a test of a sketch I just made ported to processing.js. When I load the webpage, I get the following errors from the javascript console in Chrome:

XMLHttpRequest cannot load file:///Users/aoeuaoeu/Desktop/projects/local%20site%20files/_/ee.pde. Origin null is not allowed by Access-Control-Allow-Origin. processing.js:27Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101

Here's the source of the page I'm loading:

<!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: [email protected]> 
<script src="processing.js"></script>   
<canvas data-processing-sources="ee.pde"></canvas>  
</head>
<body>
</body>
</html>

ee.pde and processing.js are in the same directory as the html file, so I'm not really sure what's going on. I should also point out that I'm testing this locally, and I get a different error when I load the page once uploaded onto my ftp server. (Maybe it's chrome? I get a black box which doesn't show up on chrome on firefox once it's uploaded to the ftp server. It works fine on firefox locally)

 /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
like image 575
Mike Avatar asked Nov 21 '10 02:11

Mike


1 Answers

I just noticed this:

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

Are you running this on your desktop? If I recall correctly AJAX does NOT run from your desktop, you need a native web server setup, and running it by calling your localhost.

like image 113
Jakub Avatar answered Oct 01 '22 09:10

Jakub