PSA: load progress and error handling example

Skip to first unread message

Christian Stefansen

Sep 14, 2011, 4:51:00 PM9/14/11
[Cross-posting from native-client-discuss. -- Christian S.]


tl;dr load_progress in the SDK has been update to handle browser loading errors.

The SDK has an example called 'load_progress' which shows how to handle 'progress' events and some load events.  However, is lacked example code for handling things like browser compatibility.  The example in the repo has been updated to include check_browser.js, which is a small helper class that reads the user agent string and (if available) looks at installed plugins to determine if you are running a browser that can support NaCl.

The markup, load_progress.html, shows how to handle some of these failure conditions.  Note that you will need Chrome M15 or later to see more than two 'progress' events.  In M14, the 'progress' events fire, but there are only two: one at 0 bytes loaded and one at 100% loaded.  In M15 you get many more 'progress' events as the NaCl module loads.

Please note that the repo is in a pretty constant state of flux and might not always work as expected: developers beware.

We are hard at work on a mechanism that will keep your local SDK copy up-to-date with the latest examples, toolchains and browser support.

- Dave.S
Reply all
Reply to author
0 new messages