I have tried this countless times. According to the processing.js website all that is needed to run a sketch in the browser is the following html code:
<script src="processing-1.4.1.min.js"></script>
<canvas data-processing-sources="example.pde"></canvas>
I tested the code in the processing.js compiler by starting the server and the code works fine but here it is:
void setup()
{
size(200,200);
}
boolean pressed=false;
void draw()
{
if (pressed)
background(255);
else
background(0);
}
void mousePressed()
{
pressed=true;
}
void mouseReleased()
{
pressed=false;
}
I don't know if there is a directory problem or what but I saved a .txt file as an example.html containing the html code at the top of this query. This html file was saved in the same directory as the example.pde file. Any help would be appreciated.
processing-1.4.1.min.js
in the same folder too?