[英]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.appVersion
或navigator.userAgent
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.