HTML and CSS Reference
The normal setup for using Weinre is to set up your development machine as a web server and run the Weinre
Java server on it as well. Grab the IP address of your machine on the local network (described in Chapter 6,
“Being a Good Mobile Citizen”) and then hard code the script tag to your machine into the HTML of your
game. For example, if your development machine is set to the IP address 192.168.1.20, and you run Weinre on
port 8080 (which is the default), add the following to your game's HTML file:
Load your game by selecting the proper location on your machine. Next select the Weinre server location in
another browser (in the previous example, this would be http://192.168.1.20:8080); or if you run the Mac ap-
plication, just click one of the other tabs.
Although Weinre is no substitute for the full debugging environment you have on the desktop, it provides an
invaluable tool when you run into problems you need to debug directly on a mobile device.
Developer tools built into Chrome are useful for debugging and optimizing your game. Knowing how to use the
tools in your browser to hone in on exactly where you are running into a problem can make you a productive
developer because you'll never be sitting at a blank screen wondering why nothing works. A basic rule of thumb
when things aren't working is to start with a look at the Network tab, add the console.log statement, and
then move onto full step-debugging. On a mobile device your options are more limited, but using tools such as
Weinre means you'll have some more information to debug your game.