是否可以使用 PhoneGap 开发纯 HTML5 应用程序?
即使在搜索 PhoneGap 的网站和他们的支持小组之后,我仍然找不到问题的答案:
目前,我计划开发一个应用程序,该应用程序应该作为纯 HTML5 应用程序存在,能够在任何现代浏览器(Google Chrome)中运行、Safari 等)以及 Android/iPad 上的本机移动应用程序。
所以我的问题是:
是否可以使用相同的代码库来开发纯 HTML5 应用程序以及使用 PhoneGap 的本机移动应用程序?
Even after searching PhoneGap's website and their support group, I still cannot find an answer to my question:
Currently, I'm planning on developing an application that should exists as a pure HTML5 application, being able to run in any modern browser (Google Chrome, Safari, etc.) as well as on Android/iPad as native mobile applications.
So my question is:
Is it possible to use the same code base to develop both pure HTML5 applications as well as native mobile applications with PhoneGap?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PhoneGap 实际上是 HTML、javascript 和任何可能伴随您的代码的 CSS 的运行时环境。简而言之:
PhoneGap is in effect a runtime environment for HTML, javascript, and any CSS that may accompany your code. So in short:
您看,对 #HTML5 的支持因浏览器而异,并且从桌面浏览器到移动浏览器也有很大差异。如果需要将 Web 门户转换为可以通过 Phonegap 轻松完成的移动应用程序,您也可以参考此链接。 https://build.phonegap.com/ 它对我来说效果很好。
现在让我们来看看 Phonegap,phonegap 所做的是通过 javascript 创建了调用本机 api 的包装器。现在,为了显示内容,他们使用 WebView 对象,该对象在您的应用程序中呈现 html5 页面。您也可以创建自己的包装器。没那么困难。
因此,如果您的应用程序只是一个基于 Web 的门户,不需要太多本机访问,您可以轻松地重用一个代码库,使用 Phonegap 制作#跨平台应用程序。否则你需要使用混合应用程序。
See, the support for #HTML5 varies from browser to browser, and varies a lot from a desktop browser to mobile browser. If one has to convert web-portal to a mobile application that can easily be done through Phonegap, you can refer to this link also. https://build.phonegap.com/ It worked fine for me.
Now lets come to Phonegap, what phonegap does is it has created wrapper through javascript that calls the native apis. Now to show content they use WebView object which renders your html5 page in your app. And you can create your own wrappers too. Not that much difficult.
So if your app is only a web based portal, that does not need much native access, you can easily reuse one codebase make #cross-platform apps using Phonegap. Else you need to go for hybrid apps.