简体   繁体   English

通过JavaScript检测移动操作系统

[英]Detect Mobile Operating Systems via JavaScript

I'm developing a google gadget which needs to display one way if it is being viewed on a mobile/smartphone operating system (eg Android, iPhone, or any device that uses a mobile iGoogle page). 我正在开发一个Google小工具,如果要在移动/智能手机操作系统(例如Android,iPhone或使用移动iGoogle页面的任何设备)上查看它,则需要以一种方式显示它。 But I only want it to display that way if the operating system is using mobile iGoogle. 但是,我只希望它在操作系统使用移动iGoogle时以这种方式显示。

I simply need JavaScript code to detect the operating system (if this can be done from within a google gadget). 我只需要JavaScript代码来检测操作系统(如果可以从google小工具中完成)。 I've done a bit of research, but none of the codes are very simple. 我做了一些研究,但是没有一个代码很简单。

Does anybody have ideas or suggestions? 有人有想法或建议吗?

You can find out what OS you are on by using the following: 您可以使用以下方法找出正在使用的操作系统:

navigator.appVersion or navigator.userAgent navigator.appVersionnavigator.userAgent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 通过 JavaScript 检测用户设备是否使用移动操作系统 - Detect via JavaScript if mobile operating system is used by the users device 使用javascript检测不同操作系统的窗口的标题栏高度 - detect the the title bar height for a window for different operating systems with javascript 通过Javascript检测移动设备 - Detect mobile device via Javascript 如何通过JavaScript检测性能低下的手机? - How to detect low performance mobile via javascript? 在Javascript中(或通过CSS)检测小(移动)屏幕 - Detect small (mobile) screen in Javascript (or via css) 通过用户代理检测设备,操作系统和浏览器版本是否不好? - Is it not good to detect devices, operating systems and browsers Versions by User-agents? 在javascript中捕获不同操作系统上的撤消,重做和其他关键事件 - Capture undo, redo and other key events on different Operating systems in javascript 是否可以通过JavaScript或HTTP标头检测*“移动设备”的类型? - Possible to detect the *type of mobile device* via javascript or HTTP Headers? 通过Mobile Safari中的JavaScript检测关闭浏览器选项卡? - Detect closing browser tab via JavaScript in the Mobile Safari? Javascript 检测是否在移动设备上 - Javascript detect if on mobile device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM