Testing the Application in Google Chrome

To test the current ElectroServer JavaScript API, you need to start Google Chrome with web security disabled. The method of doing this varies by operating system, but on Mac OS X, you can open a Terminal session and execute the following command (which will open Chrome if you have it in your Applications folder):

/Applications/Google\ Chrome.app/Contents/MacOS/Google\
    Chrome --disable-web-security

On a Windows-based PC, input a command similar to this from a command prompt or from a .bat file:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    --disable-web-security

Note

Obviously this is not a workable solution for a production application. As Electrotank (and other companies who make similar products) continue to improve the functionality of their APIs and add support for HTML5 WebSockets, this limitation should disappear.

The best way to test a multiplayer application on your own development machine is to open two web browsers or two web browser windows at the same time. When you look at CH11EX2.html in Google Chrome using this method, you should see something that looks like Figure 11-5.

ElectroServer chat demo on the canvas with JavaScript API

Figure 11-5. ElectroServer chat demo on the canvas with JavaScript API

Get HTML5 Canvas, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.