diff options
Diffstat (limited to 'files/zh-cn/archive/b2g_os/quickstart/开源web应用程序简介/index.html')
-rw-r--r-- | files/zh-cn/archive/b2g_os/quickstart/开源web应用程序简介/index.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/files/zh-cn/archive/b2g_os/quickstart/开源web应用程序简介/index.html b/files/zh-cn/archive/b2g_os/quickstart/开源web应用程序简介/index.html new file mode 100644 index 0000000000..bb2a8127cd --- /dev/null +++ b/files/zh-cn/archive/b2g_os/quickstart/开源web应用程序简介/index.html @@ -0,0 +1,87 @@ +--- +title: 开源Web应用程序简介 +slug: Archive/B2G_OS/Quickstart/开源Web应用程序简介 +translation_of: Archive/B2G_OS/Quickstart/Intro_to_open_web_apps +--- +<div class="note"> +<p><strong>Note</strong>: The Quickstart section has been updated with a <a href="/en-US/Apps/Quickstart">new, more focused Quickstart article</a>, which replaces all the previous Quickstart articles. We hope you'll find this more useful, and a quicker learning experience than the older set of articles.</p> +</div> + +<p><img alt="Multi devices" src="/files/4523/multidevices.png" style="width: 640px; height: 225px;"></p> + +<div class="summary"> +<p>本文的目的是为那些希望学习更多关于开放式Web应用程序的人提供一个良好的起点,无论你是开发人员或者项目经理,或者应用程序开发或交付中的其他角色。在这里我们将提供一个简洁、更深层次的关于Web应用程序的概述,以及其背后的理念。</p> +</div> + +<p>开放的Web应用程序本质上同标准的网站或页面是没有什么不同的。它们是用标准的开放的网络技术---- HTML,CSS,Javascript 等等。----并且可以使用浏览器访问。主要的区别是它们可以安装到<span>设备并且可以脱机工作,并使用先进的API用于与设备进行交互,如相机,地址簿,和其他类似的东西。此外,它们几乎都是尽可能用开放的技术开发的。区别在于平台技术的实现,努力确保两者都支持,其一:通过不同的平台相结合的特征检测和适当的代码,其二:优美的退化。</span></p> + +<h2 id="开放式Web应用程序的优势">开放式Web应用程序的优势</h2> + +<p>我们来看一看关于开放式Web应用程序优势的一些细节:</p> + +<ul> + <li>本地安装和离线存储: 开放式Web应用程序可以安装在设备上及像本地安装和IndexedDB 有效的API上,以提供本地资料储存的容量。此外, 开放式Web技术倾向比原生apps更小的台面空间以及自动升级generally be updated automically rather than having to install a complete new package each time there's an update. (an exception to this is packaged apps, which require a whole new package when updating.) Apps are therefore less dependent on an always-on Web connection, and more useful when networks are patchy.</li> + <li><strong>Hardware access</strong>: The metadata provided with Open Web Apps can be used to grant the application permission to privileged APIs that enable usage of device hardware features, something the Web platform has not traditionally enjoyed.</li> + <li><strong>Breaking the walled gardens</strong>: The norm for mobile platforms tends to be be walled gardens written with proprietary technologies, so apps are locked inside their platforms. And smartphones tend to be expensive, and require credit cards for app purchases. Open Web Apps tend to be able to run on much cheaper hardware, especially in the case of Firefox OS devices where you've literally just got Firefox running on top of a lightweight Linux kernel. And they are written using open Web technologies, which is the most distributed platform around. In addition, Firefox OS devices feature payment systems where you can simply prepay for apps, or add the cost to your phone bill.</li> + <li><strong>Open Web App stores</strong>: Following on from the previous point, you can choose to host your apps in an existing marketplace (such as the <a href="https://marketplace.firefox.com/">Firefox Marketplace</a>), or host them somewhere else entirely. It's up to you. Mozilla aims to put the developer back in control of every aspect of the app experience — from easy development to distribution to direct customer relationship management. And the apps can be searched for just like any other Web-based experience.</li> +</ul> + +<p>The following video also looks at general advantages of open web apps, and developing for the Firefox OS platform:</p> + +<p style="text-align: center;"></p><div class="intrinsic-wrapper"><div class="intrinsic-container "><iframe src="https://www.youtube.com/embed/RJJkFshnnVc?rel=0&html5=1"></iframe></div></div><p></p> + +<h2 id="The_Web_is_the_platform">The Web is the platform</h2> + +<p>An open web app as it exists as installed on a platform like Firefox OS is not a bookmark — it’s a proper part of the system. Open Web Apps hold that great promise. They are an opportunity that we should not miss, otherwise the Web might become fragmented once more. With this in mind it should be made clear that Open Web Apps (OWA in short) are intended to be standardized and to become part of "the Web". If successful, OWA should eventually work on all browsers, operating systems and devices.</p> + +<p>At Mozilla we are working hard to create this apps platform that is backed entirely by the open Web. It’s not intended to be a “Mozilla platform” or a “Firefox platform”. <strong>The Web is the platform</strong>. We’re creating a set of open APIs and implementations to show how portable apps can exist on the Web without vendor lock-in. Other groups like Facebook and Google Chrome are also working on apps platforms backed by the Web. <a href="https://developers.facebook.com/docs/guides/canvas/">Facebook apps</a> are meant to hook into Facebook and <a href="http://www.google.com/intl/en/chrome/webstore/apps.html">Chrome apps</a> are designed for Chrome OS devices and Google servers. Chrome apps are the most similar to Open Web Apps. We continue to collaborate with the Google Chrome team as app standards evolve and we definitely share a lot of the same vision. There is tremendous potential for all Web based app platforms to converge and we invite all vendors to help us build the right Open Web App APIs.</p> + +<p>Even though currently you must have a Mozilla Firefox-based engine ("Web runtime") to use Open Web Apps, it is not intended that this always will be the case. Many parts of the Open Web Apps project are still being worked out and it isn't possible to implement everything in all browsers at once. Although many parts of Open Web Apps are already standardized, many other parts are still in flux. It is intended and hoped that Open Web Apps will be a standard capability that is available in all major browsers.</p> + +<p>Therefore, when you read the MDN pages that deal with Open Web Apps, please keep in mind that even though much of the information is specific to Firefox right now, it will hopefully enable you to develop Open Web Apps for all browsers in the future.</p> + +<h2 id="Web_standards">Web standards</h2> + +<p>OWA technology is not a single piece, it is an umbrella that groups many different technologies and some of them are very young. At the moment, parts of OWA are standardized (HTML5, CSS, JavaScript, IndexedDB, etc.). Other parts are not yet standardized and the Mozilla implementation is thus specific to Firefox or to some other Mozilla technology. As the Mozilla mission is to share and to empower everyone, this situation is only temporary. That's why in the OWA docs we will try to clearly identify the parts of OWA that are not yet standardized.</p> + +<p>Please also note that there may be some OWA-related proposals and potential standards that are not used by Mozilla.</p> + +<h3 id="Intended_eventual_standards">Intended eventual standards</h3> + +<p>So here are the parts not standardized yet across the different Web platforms and that still are Firefox-only for the moment:</p> + +<ul> + <li><a href="/en-US/docs/Web/Apps/Manifest">OWA manifest</a> for defining an app</li> + <li><a href="/en-US/docs/Web/Apps/JavaScript_API">The Complete OWA API</a> for working with apps</li> + <li><a href="https://wiki.mozilla.org/WebAPI">Web APIs</a> to access things like phone, geolocation, etc. Also see <a href="http://arewemobileyet.com/">arewemobileyet.com</a> for a status report.</li> + <li><a href="/en-US/docs/Mozilla/Persona">Identity (Persona)</a> to work with user data</li> + <li><a href="https://wiki.mozilla.org/WebAPI/WebPayment">WebPayment API</a> to facilitate in-app payments and app purchases from any Marketplace</li> + <li><a href="https://wiki.mozilla.org/Apps/WebApplicationReceipt">OWA Receipts</a> to verify paid apps on any device and sell apps from any Marketplace</li> +</ul> + +<h3 id="Marketplace">Marketplace</h3> + +<h4 id="Buy_Once_Run_Everywhere">Buy Once, Run Everywhere</h4> + +<p>From the ground up Mozilla has been building an apps system that lets users buy an app once and run it on all of their HTML5 devices. Very soon Mozilla will <a href="http://bits.blogs.nytimes.com/2012/09/07/a-firefox-smartphone-for-the-poor/">launch the first Firefox OS phone</a> but that will be just one device on which to run your apps. When you purchase an app through the <a href="https://marketplace.firefox.com/">Firefox Marketplace</a>, the system installs a receipt on your device. The <a href="https://wiki.mozilla.org/Apps/WebApplicationReceipt">receipt</a> is a JSON Web Token with metadata that links to the Marketplace’s public key and its verification service URL. When an app starts up it can verify the receipt but the receipt on the device <em>is not tied</em> to the Firefox Marketplace. The receipt is just a cryptographically verifiable proof of purchase. Anyone can sell open Web apps if they follow the receipt specs. <strong>When you buy an app, it is intended to be portable across any device that supports the Open Web Apps system.</strong></p> + +<p>Mozilla is building the infrastructure needed to run Open Web Apps on any HTML5 device. <a href="http://www.mozilla.org/en-US/firefox/mobile/features/">Firefox for Android</a> will let you install and run apps (you can try it today on the <a href="http://nightly.mozilla.org/">nightly</a> build). Installed app icons go to your home screen just like regular Android apps. You can also install and run Web apps on your Windows, Mac, or Linux desktop using Firefox (this currently works in the <a href="http://nightly.mozilla.org/">nightly</a> build). Currently some version of Firefox is required, but it is intended that the Open Web Apps system will eventually be supported by all major browsers as a set of standards. From day one Mozilla has included all major HTML5 compliant browsers in its proof of concepts; you can take a look at this hosted JavaScript <a href="https://persona.org/include.js">shim</a> for ideas on how to support the apps platform on a non-Firefox browser.</p> + +<p>In the future the Open Web Apps system will support <a href="http://docs.services.mozilla.com/aitc/">syncing your installed apps</a> across devices. Since receipts are portable you could just sync them yourself if you wanted to. In case it’s not obvious, you can always run a free open Web app in any browser because it is no different than a website. It might, however, use new <a href="https://wiki.mozilla.org/WebAPI/">mobile specific web APIs</a> which are not implemented on all platforms.</p> + +<p>The video below provides a useful overview of the advantages of open marketplaces and an open web approach to app discovery:</p> + +<p style="text-align: center;"></p><div class="intrinsic-wrapper"><div class="intrinsic-container "><iframe src="https://www.youtube.com/embed/QCH_ncCrZfE?rel=0&html5=1"></iframe></div></div><p></p> + +<h3 id="WebPayment_API">WebPayment API</h3> + +<h4 id="Commerce_For_Apps">Commerce For Apps</h4> + +<p>Part of the success of mobile app platforms like iOS and Android is that they make it very easy to try out new business models through mobile payments. Those models are still evolving but commerce is no doubt something that, at the moment, is awkward on the desktop Web and more natural on mobile. Specifically, it’s very convenient to charge something to your phone bill when you’re already accessing it from your phone anyway. With the launch of Firefox OS, the apps ecosystem will support app purchases and in-app payments through the <a href="https://wiki.mozilla.org/WebAPI/WebPayment" style="">WebPayment API</a>. Supporting commerce is crucial for the growth of an apps platform. <strong>The use of the proposed payment API is completely <em>optional</em></strong>. Mozilla won’t prevent any app from using its own in-app payment system.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="https://blog.mozilla.org/webdev/2012/09/14/apps-the-web-is-the-platform/">Apps: The Web Is The Platform</a>, by Kumar McMillan (the blog post from which lots of the content of this article is borrowed)</li> + <li><a href="https://plus.google.com/113127438179392830442/posts/fR3iiuN4kEF">See the Web platform succeed for applications</a>, by Paul Irish</li> +</ul> |