1 {{+bindTo:partials.standard_nacl_article}}
4 <span id=
"devcycle-running"></span><h1 id=
"running"><span id=
"devcycle-running"></span>Running
</h1>
5 <div class=
"contents local" id=
"contents" style=
"display: none">
7 <li><a class=
"reference internal" href=
"#introduction" id=
"id6">Introduction
</a></li>
8 <li><a class=
"reference internal" href=
"#portable-native-client-pnacl-applications" id=
"id7">Portable Native Client (PNaCl) applications
</a></li>
9 <li><a class=
"reference internal" href=
"#native-client-applications-and-the-chrome-web-store" id=
"id8">Native Client applications and the Chrome Web Store
</a></li>
10 <li><p class=
"first"><a class=
"reference internal" href=
"#prerequisites" id=
"id9">Prerequisites
</a></p>
11 <ul class=
"small-gap">
12 <li><a class=
"reference internal" href=
"#browser-and-pepper-versions" id=
"id10">Browser and Pepper versions
</a></li>
13 <li><a class=
"reference internal" href=
"#chrome-cache" id=
"id11">Chrome Cache
</a></li>
16 <li><p class=
"first"><a class=
"reference internal" href=
"#requirements" id=
"id12">Requirements
</a></p>
17 <ul class=
"small-gap">
18 <li><a class=
"reference internal" href=
"#native-client-flag" id=
"id13">Native Client flag
</a></li>
19 <li><a class=
"reference internal" href=
"#web-server" id=
"id14">Web server
</a></li>
22 <li><a class=
"reference internal" href=
"#technique-1-local-server" id=
"id15">Technique
1: Local server
</a></li>
23 <li><a class=
"reference internal" href=
"#technique-2-packaged-application-loaded-as-an-unpacked-extension" id=
"id16">Technique
2: Packaged application loaded as an unpacked extension
</a></li>
24 <li><a class=
"reference internal" href=
"#technique-3-hosted-application-loaded-as-an-unpacked-extension" id=
"id17">Technique
3: Hosted application loaded as an unpacked extension
</a></li>
25 <li><a class=
"reference internal" href=
"#technique-4-chrome-web-store-application-with-trusted-testers" id=
"id18">Technique
4: Chrome Web Store application with trusted testers
</a></li>
28 </div><h2 id=
"introduction">Introduction
</h2>
29 <p>This document describes how to run Native Client applications during
31 <p>The workflow for PNaCl applications is straightfoward and will only be discussed
32 briefly. For NaCl applications distributed through the web-store, there is a
33 number of options and these will be discussed more in-depth.
</p>
34 <h2 id=
"portable-native-client-pnacl-applications">Portable Native Client (PNaCl) applications
</h2>
35 <p>Running PNaCl applications from the open web is enabled in Chrome version
31 and
36 above; therefore, no special provisions are required to run and test such
37 applications locally. An application that uses a PNaCl module can be tested
38 similarly to any other web application that only consists of HTML, CSS and
40 <p>To better simulate a production environment, it
’s recommended to start a local
41 web server to serve the application
’s files. The NaCl SDK comes with a simple
42 local server built in, and the process of using it to run PNaCl applications is
43 described in
<a class=
"reference internal" href=
"/native-client/devguide/tutorial/tutorial-part1.html#tutorial-step-2"><em>the tutorial
</em></a>.
</p>
44 <h2 id=
"native-client-applications-and-the-chrome-web-store">Native Client applications and the Chrome Web Store
</h2>
45 <p>Before reading about how to run Native Client applications, it
’s important to
46 understand a little bit about how Native Client applications are distributed.
47 As explained in
<a class=
"reference internal" href=
"/native-client/devguide/distributing.html"><em>Distributing Your Application
</em></a>, Native
48 Client applications must currently be distributed through the
<strong>Chrome Web
49 Store (CWS)
</strong>. Applications in the CWS are one of three types:
</p>
50 <ul class=
"small-gap">
51 <li>A
<strong>hosted application
</strong> is an application that you host on a server of your
52 choice. To distribute an application as a hosted application, you upload
53 application metadata to the CWS. Learn more on the
<a class=
"reference external" href=
"/apps">Chrome App
</a>
54 documentation page.
</li>
55 <li>A
<strong>packaged application
</strong> is an application that is hosted in the CWS and
56 downloaded to the user
’s machine. To distribute an application as a packaged
57 application, you upload the entire application, including all application
58 assets and metadata, to the CWS. Learn more on the
<a class=
"reference external" href=
"/apps">Chrome App
</a>
59 documentation page.
</li>
60 <li>An
<strong>extension
</strong> is a packaged application that has a tiny UI component
61 (extensions are typically used to extend the functionality of the Chrome
62 browser). To distribute an application as an extension, you upload the entire
63 application, including all application assets and metadata, to the CWS. Learn
64 more on the
<a class=
"reference external" href=
"/extensions">Chrome extensions
</a> documentation page.
</li>
66 <p>The web store documentation contains a handy guide to
<a class=
"reference external" href=
"https://developer.chrome.com/webstore/choosing">help you choose which to
68 <p>It
’s clearly not convenient to package and upload files to the Chrome Web Store
69 every time you want to run a new build of your application, but there are four
70 alternative techniques you can use to run the application during development.
71 These techniques are listed in the following table and described in detail
72 below. Each technique has certain requirements (NaCl flag, web server, and/or
73 CWS metadata); these are explained in the
<a class=
"reference internal" href=
"#requirements"><em>Requirements
</em></a>
75 <table border=
"1" class=
"docutils">
78 <thead valign=
"bottom">
79 <tr class=
"row-odd"><th class=
"head" colspan=
"2">Technique
</th>
80 <th class=
"head">Requires
83 <th class=
"head">Requires
89 <tr class=
"row-even"><td colspan=
"2"><p class=
"first"><strong>1. Local server
</strong></p>
90 <blockquote class=
"last">
92 <div><p>Run a local server and simply point your browser to
93 your application on the server.
</p>
95 This technique requires the NaCl flag.
100 <td><img alt=
"CHK" src=
"/native-client/images/check-red.png" /></td>
103 <tr class=
"row-odd"><td colspan=
"2"><p class=
"first"><strong>2. Packaged application loaded as an unpacked
104 extension
</strong></p>
105 <blockquote class=
"last">
107 <div>Load your packaged application into Chrome as an
108 unpacked extension and run it without a server. An
109 unpacked extension is an application whose source and
110 metadata files are located in an unzipped folder on
111 your development machine. The CWS manifest file
112 (explained below) must specify a local_path field.
</div></blockquote>
116 <td><img alt=
"CHK" src=
"/native-client/images/check-red.png" /></td>
118 <tr class=
"row-even"><td colspan=
"2"><p class=
"first"><strong>3. Hosted application loaded as an unpacked
119 extension
</strong></p>
120 <blockquote class=
"last">
122 <div>Load your hosted application into Chrome as an
123 unpacked extension and run it from a server (which can
124 be a local server). The CWS manifest file must specify
125 a web_url field.
</div></blockquote>
128 <td><img alt=
"CHK" src=
"/native-client/images/check-red.png" /></td>
129 <td><img alt=
"CHK" src=
"/native-client/images/check-red.png" /></td>
131 <tr class=
"row-odd"><td colspan=
"2"><p class=
"first"><strong>4. CWS application with untrusted testers
</strong></p>
132 <blockquote class=
"last">
134 <div>The standard technique for distributing a packaged or
135 hosted application in the CWS. You can limit the
136 application to trusted testers. This technique
137 requires a server if your application is a hosted
138 application.
</div></blockquote>
142 <td><img alt=
"CHK" src=
"/native-client/images/check-red.png" /></td>
146 <p>Which of the above techniques you use to run your application during development
147 is largely a matter of personal preference (i.e., would you rather start a local
148 server or create CWS metadata?). As a general rule, once you have an idea of how
149 you plan to distribute your application, you should use the corresponding
150 technique during development. Choosing a distribution option depends on a number
151 of factors such as application size, application start-up time, hosting costs,
152 offline functionality, etc. (see
<a class=
"reference internal" href=
"/native-client/devguide/distributing.html"><em>Distributing Your Application
</em></a> for details), but you don
’t need to make a decision about how
153 to distribute your application at the outset.
</p>
154 <p>The next two sections of this document describe a couple of prerequisites for
155 running applications during development, and explain the three requirements
156 listed in the table above (NaCl flag, web server, and CWS metadata). The
157 subsequent sections of the document provide instructions for how to use each of
158 the four techniques.
</p>
159 <h2 id=
"prerequisites">Prerequisites
</h2>
160 <h3 id=
"browser-and-pepper-versions">Browser and Pepper versions
</h3>
161 <p>Before you run a new build of your application, make sure that you
’re using the
162 correct version of Chrome. Each version of Chrome supports a corresponding
163 version of the Pepper API. You (and your users) must use a version of Chrome
164 that is equal to or higher than the version of the Pepper API that your
165 application uses. For example, if you compiled your application using the
166 <code>pepper_37
</code> bundle, your application uses the Pepper
37 API, and you must run
167 the application in Chrome
37 or higher. To check which version of Chrome you
’re
168 using, type
<code>about:version
</code> in the Chrome address bar.
</p>
169 <h3 id=
"chrome-cache"><span id=
"cache"></span>Chrome Cache
</h3>
170 <p>Chrome caches resources aggressively. You should disable Chrome
’s cache whenever
171 you are developing a Native Client application in order to make sure Chrome
172 loads new versions of your application. Follow the instructions
<a class=
"reference internal" href=
"/native-client/devguide/tutorial/tutorial-part1.html#tutorial-step-3"><em>in the
173 tutorial
</em></a>.
</p>
174 <h2 id=
"requirements"><span id=
"id2"></span>Requirements
</h2>
175 <h3 id=
"native-client-flag"><span id=
"flag"></span>Native Client flag
</h3>
176 <p>Native Client is automatically enabled for applications that are installed from
177 the Chrome Web Store. To enable Native Client for applications that are not
178 installed from the Chrome Web Store, you must explicitly turn on the Native
179 Client flag in Chrome as follows:
</p>
180 <ol class=
"arabic simple">
181 <li>Type
<code>about:flags
</code> in the Chrome address bar.
</li>
182 <li>Scroll down to
“Native Client
”.
</li>
183 <li>If the link below
“Native Client
” says
“Disable
”, then Native Client is
184 already enabled and you don
’t need to do anything else.
</li>
185 <li>If the link below
“Native Client
” says
“Enable
”:
<ul class=
"small-gap">
186 <li>Click the
“Enable
” link.
</li>
187 <li>Click the
“Relaunch Now
” button in the bottom of the screen.
<strong>Native
188 Client will not be enabled until you relaunch your browser
</strong>. All browser
189 windows will restart when you relaunch Chrome.
</li>
193 <p>If you enable the Native Client flag and still can
’t run applications from
194 outside the Chrome Web Store, you may need to enable the Native Client plugin:
</p>
195 <ol class=
"arabic simple">
196 <li>Type
<code>about:plugins
</code> in the Chrome address bar.
</li>
197 <li>Scroll down to
“Native Client
”.
</li>
198 <li>If the link below
“Native Client
” says
“Enable
”, click the link to enable
199 the Native Client plugin. You do not need to relaunch Chrome after enabling
200 the Native Client plugin.
</li>
202 <h3 id=
"web-server"><span id=
"id3"></span>Web server
</h3>
203 <p>For security reasons, Native Client applications must come from a server (you
204 can
’t simply drag HTML files into your browser). The Native Client SDK comes
205 with a lightweight Python web server that you can run to serve your application
206 locally. The server can be invoked from a Makefile. Here is how to run the
212 <p>By default, the server listens for requests on port
5103. You can use the server
213 to run most applications under the
<code>examples
</code> directory where you started the
214 server. For example, to run the
<code>flock
</code> example in the SDK, start the server
215 and point your browser to
<code>http://localhost:
5103/demo/flock/
</code>.
</p>
216 <p>Some of the applications need special flags to Chrome, and must be run with the
217 <code>make run
</code> command. See
<a class=
"reference internal" href=
"/native-client/sdk/examples.html#running-the-sdk-examples"><em>Run the SDK examples
</em></a> for more details.
</p>
218 <h4 id=
"chrome-web-store-metadata"><span id=
"metadata"></span>Chrome Web Store metadata
</h4>
219 <p>Applications published in the Chrome Web Store must be accompanied by CWS
220 metadata; specifically, a Chrome Web Store manifest file named
221 <code>manifest.json
</code>, and at least one icon.
</p>
222 <p>Below is an example of a CWS manifest file for a
<strong>hosted application
</strong>:
</p>
223 <pre class=
"prettyprint">
225 "name
":
"My NaCl App
",
226 "description
":
"Simple game implemented using Native Client
",
227 "version
":
"0.1",
229 "128":
"icon128.png
"
233 "http://mysubdomain.example.com/
"
235 "launch
": {
236 "web_url
":
"http://mysubdomain.example.com/my_app_main_page.html
"
241 <p>For a
<strong>packaged application
</strong>, you can omit the urls field, and replace the
242 <code>web_url
</code> field with a
<code>local_path
</code> field, as shown below:
</p>
243 <pre class=
"prettyprint">
245 "name
":
"My NaCl App
",
246 "description
":
"Simple game implemented using Native Client
",
247 "version
":
"0.1",
249 "16":
"icon16.png
",
250 "128":
"icon128.png
"
253 "launch
": {
254 "local_path
":
"my_app_main_page.html
"
259 <p>You must put the
<code>manifest.json
</code> file in the same directory as your
260 application
’s main HTML page.
</p>
261 <p>If you don
’t have icons for your application, you can use the following icons as
263 <p><img alt=
"ICON16" src=
"/native-client/images/icon16.png" /></p>
264 <p><img alt=
"ICON128" src=
"/native-client/images/icon128.png" /></p>
265 <p>Put the icons in the same directory as the CWS manifest file. For more
266 information about CWS manifest files and application icons, see:
</p>
267 <ul class=
"small-gap">
268 <li><a class=
"reference external" href=
"/webstore/get_started_simple">Chrome Web Store Tutorial: Getting Started
</a></li>
269 <li><a class=
"reference external" href=
"/extensions/manifest">Chrome Web Store Formats: Manifest Files
</a></li>
271 <h2 id=
"technique-1-local-server">Technique
1: Local server
</h2>
272 <p>To run your application from a local server:
</p>
273 <ul class=
"small-gap">
274 <li>Enable the
<a class=
"reference internal" href=
"#flag"><em>Native Client flag
</em></a> in Chrome.
</li>
275 <li>Start a
<a class=
"reference internal" href=
"#web-server"><em>local web server
</em></a>.
</li>
276 <li>Put your application under the examples directory in the SDK bundle you are
277 using (for example, in the directory
<code>pepper_35/examples/my_app
</code>).
</li>
278 <li>Access your application on the local server by typing the location of its
279 HTML file in Chrome, for example:
280 <code>http://localhost:
5103/my_app/my_app_main_page.html
</code>.
</li>
283 <strong>Note:
</strong> You don
’t have to use a local web server
—you can use another
284 server if you already have one running. You must still enable the Native
285 Client flag in order to run your application from the server.
287 <h2 id=
"technique-2-packaged-application-loaded-as-an-unpacked-extension">Technique
2: Packaged application loaded as an unpacked extension
</h2>
288 <p>For development purposes, Chrome lets you load a packaged application as an
289 unpacked extension. To load and run your packaged application as an unpacked
291 <ol class=
"arabic simple">
292 <li>Create a Chrome Web Store manifest file and one or more icons for your
293 application.
<ul class=
"small-gap">
294 <li>Follow the instructions above under Chrome Web Store metadata to create
296 <li>Note that the CWS manifest file should contain the
<code>local_path
</code> field
297 rather than the
<code>web_url
</code> field.
</li>
300 <li>Put the CWS manifest file and the application icon(s) in the same directory
301 as your application
’s main HTML page.
</li>
302 <li>Load the application as an unpacked extension in Chrome:
<ul class=
"small-gap">
303 <li>Bring up the extensions management page in Chrome by clicking the menu
304 icon
<img alt=
"menu-icon" src=
"/native-client/images/menu-icon.png" /> and choosing
<strong>Tools
> Extensions
</strong>.
</li>
305 <li>Check the box for
<strong>Developer mode
</strong> and then click the
<strong>Load unpacked
306 extension
</strong> button:
307 <img alt=
"extensions" src=
"/native-client/images/extensions-management.png" /></li>
308 <li>In the file dialog that appears, select your application directory. Unless
309 you get an error dialog, you
’ve now installed your app in Chrome.
</li>
312 <li>Open a new tab in Chrome and click the
<strong>Apps
</strong> link at the bottom of the
313 page to show your installed apps:
314 <img alt=
"new-tab-apps" src=
"/native-client/images/new-tab-apps.png" /></li>
315 <li>The icon for your newly installed app should appear on the New Tab page.
316 Click the icon to launch the app.
</li>
318 <p>For additional information about how to create CWS metadata and load your
319 application into Chrome (including troubleshooting information), see the
320 <a class=
"reference external" href=
"/webstore/get_started_simple">Chrome Web Store Tutorial: Getting Started
</a>.
</p>
321 <p>See also
<a class=
"reference internal" href=
"/native-client/sdk/examples.html#run-sdk-examples-as-packaged"><em>Run the SDK examples as Chrome apps
</em></a>.
</p>
322 <h2 id=
"technique-3-hosted-application-loaded-as-an-unpacked-extension">Technique
3: Hosted application loaded as an unpacked extension
</h2>
323 <p>For development purposes, Chrome lets you load a hosted application as an
324 unpacked extension. To load and run your hosted application as an unpacked
326 <ol class=
"arabic simple">
327 <li>Start a web server to serve your application.
<ul class=
"small-gap">
328 <li>You can use the
<a class=
"reference internal" href=
"#web-server"><em>local web server
</em></a> included with the
329 Native Client SDK if you want.
</li>
332 <li>Upload your application (.html, .nmf, .nexe, .css, .js, image files, etc.)
333 to the server.
<ul class=
"small-gap">
334 <li>If you
’re using the local server included with the Native Client SDK,
335 simply put your application under the
<code>examples
</code> directory in the SDK
336 bundle you are using (e.g., in the directory
337 <code>pepper_37/examples/my_app
</code>).
</li>
340 <li>Create a Chrome Web Store manifest file and one or more icons for your
341 application.
<ul class=
"small-gap">
342 <li>Follow the instructions above under
<a class=
"reference internal" href=
"#metadata"><em>Chrome Web Store metadata
</em></a> to create these files.
</li>
343 <li>In the CWS manifest file, the
<code>web_url
</code> field should specify the
344 location of your application on your server. If you
’re using the local
345 server included with the SDK, the
<code>web_url
</code> field should look something
346 like
<code>http://localhost:
5103/my_app/my_app_main_page.html
</code>.
</li>
349 <li>Put the CWS manifest file and the application icon(s) in the same directory
350 as your application
’s main HTML page.
</li>
351 <li>Load the application as an unpacked extension in Chrome:
<ul class=
"small-gap">
352 <li>Bring up the extensions management page in Chrome by clicking the menu
353 icon
<img alt=
"menu-icon" src=
"/native-client/images/menu-icon.png" /> and choosing
<strong>Tools
> Extensions
</strong>.
</li>
354 <li>Check the box for
<strong>Developer mode
</strong> and then click the
<strong>Load unpacked
355 extension
</strong> button:
356 <img alt=
"extensions" src=
"/native-client/images/extensions-management.png" /></li>
357 <li>In the file dialog that appears, select your application directory. Unless
358 you get an error dialog, you
’ve now installed your app in Chrome.
</li>
361 <li>Open a new tab in Chrome and click the
<strong>Apps
</strong> link at the bottom of the
362 page to show your installed apps:
363 <img alt=
"new-tab-apps" src=
"/native-client/images/new-tab-apps.png" /></li>
364 <li>The icon for your newly installed app should appear on the New Tab page.
365 Click the icon to launch the app.
</li>
367 <p>For additional information about how to create CWS metadata and load your
368 application into Chrome (including troubleshooting information), see the
369 <a class=
"reference external" href=
"/webstore/get_started_simple">Chrome Web Store Tutorial: Getting Started
</a>.
</p>
370 <h2 id=
"technique-4-chrome-web-store-application-with-trusted-testers">Technique
4: Chrome Web Store application with trusted testers
</h2>
371 <p>When you
’re ready to test your application more broadly, you can upload the
372 application to the Chrome Web Store and let some trusted testers run it. Here
374 <ol class=
"arabic simple">
375 <li>Create the Chrome Web Store metadata required to publish your application:
<ul class=
"small-gap">
376 <li>First, create a Chrome Web Store manifest file and one or more icons for
377 your application, as described above under
<a class=
"reference internal" href=
"#metadata"><em>Chrome Web Store metadata
</em></a>. Note that packaged applications must have at least two icons
378 (a
16x16 icon and a
128x128 icon).
</li>
379 <li>You also need to create the following additional assets before you can
380 publish your application:
<ul class=
"small-gap">
381 <li>a screenshot (size must be
640x400 or
1280x800)
</li>
382 <li>a promotional image called a
“small tile
” (size must be
440x280)
</li>
387 <li>For a
<strong>packaged application
</strong>:
<ul class=
"small-gap">
388 <li>Create a zip file with the CWS manifest file, the application icons, and
389 all your application files (.html, .nmf, .nexe, .css, .js, image files,
393 <li>For a
<strong>hosted application
</strong>:
<ul class=
"small-gap">
394 <li>Create a zip file with the CWS manifest file and the application icon(s).
</li>
395 <li>Upload the application files (.html, .nmf, .nexe, .css, .js, image files,
396 etc.) to the server on which the application is being hosted.
</li>
397 <li>Use
<a class=
"reference external" href=
"http://www.google.com/webmasters/tools/">Google Webmaster Tools
</a> to
398 verify ownership of the website on which the application runs.
</li>
401 <li>Log in to the
<a class=
"reference external" href=
"https://chrome.google.com/webstore/developer/dashboard">Chrome Web Store Developer Dashboard
</a>.
<ul class=
"small-gap">
402 <li>The first time you log in, click the
“Add new item
” button to display the
403 Google Chrome Web Store Developer Agreement. Review and accept the
404 agreement and then return to the
<a class=
"reference external" href=
"https://chrome.google.com/webstore/developer/dashboard">Developer Dashboard
</a>.
</li>
407 <li>Click
“Edit your tester accounts
” at the bottom of the Developer Dashboard.
</li>
408 <li>Enter a series of email addresses for your testers (separated by commas or
409 whitespace), and click the
“Save Changes
” button.
</li>
410 <li>Click the
“Add new item
” button to add your application to the Chrome Web
412 <li>Click the
“Choose file
” button and select the zip file you created earlier.
</li>
413 <li>Click the
“Upload
” button; this uploads your zip file and opens the
“Edit
414 item
” page.
</li>
415 <li>Edit the following required fields on the
“Edit item
” page:
<ul class=
"small-gap">
416 <li>Upload an application icon.
</li>
417 <li>Upload a screenshot.
</li>
418 <li>Upload a small tile.
</li>
419 <li>Select a category for your application (accounting application, action
421 <li>Select a language for your application.
</li>
424 <li>If you are an owner or manager of a Google Group, you can select that group
425 in the
“Trusted testers
” field.
<ul class=
"small-gap">
426 <li>You may want to create a Google Group specifically for your testers. When
427 you add a group to the
“Trusted testers
” field, all group members will be
428 able to test the application, in addition to the individuals you added to
429 the
“trusted tester accounts
” field on the Developer Dashboard.
</li>
432 <li>Click the
“Publish to test accounts
” button at the bottom of the page and
433 click
“OK
”.
</li>
434 <li>A page comes up that shows your application
’s listing in the Chrome Web
435 Store. Copy the URL and mail it to your trusted testers.
<ul class=
"small-gap">
436 <li>When you publish an application to test accounts, the application
’s CWS
437 listing is visible only to you and to people who are logged into those
438 accounts. Your application won
’t appear in search results, so you need to
439 give testers a direct link to your application
’s CWS listing. Users won
’t
440 be able to find the application by searching in the CWS.
</li>
444 <p>To publish an application to the world after publishing it to test accounts,
445 you must first unpublish the application. For additional information see
446 <a class=
"reference external" href=
"/webstore/docs/publish">Publishing Your App
</a>, and in particular
<a class=
"reference external" href=
"/webstore/publish#testaccounts">Publishing
447 to test accounts
</a>.
</p>
450 {{/partials.standard_nacl_article}}