简体   繁体   中英

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). But I only want it to display that way if the operating system is using mobile iGoogle.

I simply need JavaScript code to detect the operating system (if this can be done from within a google gadget). 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM