使用 ionic 作为桌面 Web 应用程序 [英] Use of ionic as desktop web application

查看:50
本文介绍了使用 ionic 作为桌面 Web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Ionic 是使用 html5 开发移动应用程序的绝佳框架.我们也希望在桌面浏览器上使用相同的应用程序.制作一个在桌面浏览器和移动浏览器上都效果最好的单一响应式 UI 并制作应用程序是个好主意吗?或者我们应该对浏览器和移动应用进行不同的开发.

Ionic is a great framework to develop mobile apps using html5. We want same application to be used over desktop browser also. Will it be good idea to make a single responsive UI that works best on both desktop browser and mobile browser and make app. OR we should make different development for browser and mobile app.

推荐答案

为了进一步扩展已经说过的内容,Ionic 仅针对移动设备构建和测试.例如,Internet Explorer 没有经过测试,也没有正确处理 Ionic 中的许多功能.桌面浏览器确实与移动浏览器具有不同的功能.您会严重限制可以在桌面上使用您的应用程序的浏览器.

To expand a little bit on what has already been said, Ionic is is built and tested for mobile only. Internet Explorer for example is not tested and does not properly handle a number of the features in Ionic. Desktop browsers do have different features from their mobile browser counterparts. You would seriously limit the browsers that can use your application on a desktop.

最有可能的是,您应该为桌面和移动设备提供两个不同的应用程序.除非您有胆量或能力告诉您的用户他们必须使用 Chrome(或 Opera)来运行您的网站,否则您将需要两个独立的应用程序.您仍然可以将 Ionic 用于移动网站,但无法使用 Cordova 的完整平台集成(您将仅限于浏览器提供的本机 HTML API).您当然可以将大部分业务逻辑保留在两个应用程序之间共享的公共核心中.这将需要创建一个共享的角度模块.我在一个包含 Ionic 应用程序和普通 Angular 桌面应用程序(使用 Bootstrap)的项目中完成了这项工作.

Most likely, you should provide two different applications for desktop and mobile. Unless you have the guts or ability to tell your users that they must use Chrome (or Opera) to run your website, you'll want two separate applications. You could still use Ionic for a mobile website though, but without being able to use Cordova's full platform integration (you would be limited to the native HTML APIs provided by the browser). You could certainly retain much of your business logic in a common core that is shared between both applications. That would require creating a shared angular module(s). I have done this in a project with an Ionic app and a normal Angular desktop app (with Bootstrap).

有多种方法可以检测访问者是来自桌面设备还是移动设备.我不知道一种 100% 完美的方法,因为它们通常依赖于浏览器的用户代理字符串(并且可以被欺骗、更改等).请参阅 http://detectmobilebrowsers.com/ 了解如何在服务器或编程语言.

There are a number of ways to detect if a visitor is coming from a desktop or mobile device. I don't know of a method that is 100% perfect, because they usually rely on the browser's user agent string (and can be spoofed, changed, etc). See http://detectmobilebrowsers.com/ for some common scripts or examples how to implement mobile detection on a server or in a programming language.

这篇关于使用 ionic 作为桌面 Web 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆