What’s the deal?

When you run a Processing sketch in the Processing environment locally on your computer, it is running as a Java application. An application has no security restrictions since it is assumed that a user can be trusted to do whatever they want on their own computer whenever they want to. As soon as you export your Processing sketch to a web applet, however, the situation changes. A web applet cannot be trusted by default and must come with certain security restrictions. You can imagine a scenario without restrictions where a devious programmer creates a web applet that deletes files on your hard drive while a bunny frolics on the screen. To protect users, there are certain things you cannot do in a web applet:

  • Connect to an external server
  • Connect to an external device, like a camera, microphone, microcontroller, etc.
  • Open files from a local user’s hard drive
  • Save files to a local user’s hard drive

In the Processing reference, you can always look under “Usage” and see whether a certain function works for “Applications” and/or “Web.”

There are two ways around this problem.

Signing an Applet

You can sign an applet with your name saying “Hello, I made this. Do you want to trust me to do things that I otherwise wouldn’t be allowed to do in an applet?” More information about signing an applet can be found on the Processing wiki:


Using a PHP proxy

Sometimes you can use a local php script to do the “illegal” work for you. For example, if you need to connect to an external server (to, say, grab the weather from Yahoo’s RSS Feed), you can ask a local php script to act as the “middle person” and do the external server connection for you. Here is an example PHP script that you can use for a proxy (Thanks to Shawn Van Every):


The corresponding Processing example would then look like:

String[] lines;
PFont f;
int count = 0;

void setup() {
 f = loadFont("Geneva-48.vlw");
 // Loading: http://www.yahoo.com
 lines = loadStrings("http://your_webserver/proxy.php?url=http://www.yahoo.com");

void draw() {
 count = (count + 1) % lines.length;
  • snark

    nice php example, thanx

  • EKreuz


  • Erim

    seems like this is the dark side of processing.

  • Parag Kulkarni

    Hi, I have tried to make multiple applets using JFrame and Class *…* extends PApplet. Now one of my new class is based on GifAnimation that requires the pointer to that perticular PApplet. I don’t know how can I provide address to that PApplet.

    Please help. Urgent.

    Here is the link where I got the code to have multiple applets.


  • stan tiekstra

    “geneva-48.vlw” doesn’t work