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作了精致的封装