DEFINITION 定義javascript
A web application or web app is any software that runs in a web browser. It is created in a browser-supported programming language (such as the combination of JavaScript, HTML and CSS) and relies on a web browser to render the application.
Web applications are popular due to the ubiquity of web browsers, and the convenience of using a web browser as a client, sometimes called a thin client. The ability to update and maintain web applications without distributing and installing software on potentially thousands of client computers is a key reason for their popularity, as is the inherent support for cross-platform compatibility. Common web applications include webmail, online retail sales, online auctions, wikis and many other functions. --wikiphp
在瀏覽器端構建的基於HTML/CSS/JS進行開發,使用瀏覽器進行渲染的應用程序。html
其特色體如今幾個方面html5
STORY 小故事java
The full Safari engine is inside of iPhone. And so, you can write amazing Web 2.0 and Ajax apps that look exactly and behave exactly like apps on the iPhone. And these apps can integrate perfectly with iPhone services. They can make a call, they can send an email, they can look up a location on Google Maps. And guess what? There’s no SDK that you need! You’ve got everything you need if you know how to write apps using the most modern web standards to write amazing apps for the iPhone today. So developers, we think we’ve got a very sweet story for you. You can begin building your iPhone apps today. --Steve Jobsnode
Jobs實際上是最先的web app
的倡導者之一,在當時的構想中是沒有native app
這種形式的,全部的app
都是以web
的形式存在的,可是當時的Jobs須要面對兩個問題react
而基於此的討論和考慮才逐步衍生出後來的Native App
和App Store
ios
閱讀git
CASE STUDY 案例github
DIFINITION 定義
Apps are usually available through application distribution platforms, which began appearing in 2008 and are typically operated by the owner of the mobile operating system, such as the Apple App Store, Google Play, Windows Phone Store, and BlackBerry App World. Some apps are free, while others must be bought. Usually, they are downloaded from the platform to a target device, such as an iPhone, BlackBerry, Android phone or Windows Phone, but sometimes they can be downloaded to laptops or desktop computers. For apps with a price, generally a percentage, 20-30%, goes to the distribution provider (such as iTunes), and the rest goes to the producer of the app.1 The same app can therefore cost the average Smartphone user a different price depending on whether they use iPhone, Android, or BlackBerry 10 devices. --wiki
基於手機操做系統的應用程序,使用其原生程序進行構建
其特色體如今幾個方面
CASE STUDY 案例
DEFINITION 定義
A hybrid mobile application (or hybrid mobile app) is a mobile application that runs inside of a native container and leverages the device’s web browser to display locally hosted HTML pages.[29] Hybrid mobile apps are composed mostly of HTML, JavaScript, and CSS. Device specific functionalities such as camera access, geolocation, and accelerometer readings are exposed through a JavaScript API. --wiki
其特色體如今幾個方面
JS API
暴露底層的功能接口優缺點
Pros
Cons
As for native apps, the hybrid code base requires recompilation and resubmission to the distribution network where it is possible to instantly update a mobile web app’s codebase.
CASE STUDY 案例
Hybrid
模式的倡導者WEB APP
, HYBRID APP
& NATIVE APP
選擇哪一種形態?
決定哪一種模式以前須要問本身這些問題:
App
的體驗和開發週期何者爲先?APP
的更新週期是否頻繁?native
與web
之間構建一層bridge
, 將底層的接口映射到JS API
上View
的渲染依賴於瀏覽器自身的渲染引擎,即便遊戲也不須要去寫openGL
Bridge
在不一樣的平臺經過不一樣的native
層實現,在各自平臺下完成編譯Business
能夠實如今Web
也能夠實如今Native
Plugin
構成了Bridge
的擴展現有平臺
案例
js
編寫通用的業務邏輯,使用nodejs編譯不一樣平臺的native app
View
經過Ti.UI
進行調用Native
實現,在不一樣的操做系統中調用不一樣的Native UI
實現。Ti.UI
能夠定義部分Native UI
Business
經過JS
編寫最後編譯成Native
代碼Bridge
和Build
工具進行了整合,理論上能夠跨全部平臺(meta programming?)現有平臺
案例
Titanium
嚴格來講不屬於Hybrid
,由於其最終產生的仍然是Native App
,過於牛B,不在本文知識範圍內。本文限於討論相似Cordova
的Hybrid
實現。
爲了區別普通的http
訪問的url
與hybrid
調用native
的url
,參考openurl
的標準apple提出了url schema的方法
系統自定義了能夠被識別的協議和url,例如
app自身能夠自定義url schema,而且把自定義的url註冊在調度中心, 例如
閱讀
+ URL Scheme 統計
早期的Android採用了JavascriptInterface
,可是這種方案存在注入的安全隱患,因此在Android 4.0以上的版本開始就支持了URL Schema方案
針對Hybrid使用中出現的這些問題,cordova作了精緻的封裝