Best way to detect Mac OS X or Windows computers with JavaScript or jQuery

前端 未结 4 1406
遥遥无期
遥遥无期 2020-11-28 03:07

So I\'m trying to move a \"close\" button to the left side when the user is on Mac and the right side when the user is on PC. Now I\'m doing it by examining the user agent,

4条回答
  •  死守一世寂寞
    2020-11-28 03:20

    Is this what you are looking for? Otherwise, let me know and I will remove this post.

    Try this jQuery plugin: http://archive.plugins.jquery.com/project/client-detect

    Demo: http://www.stoimen.com/jquery.client.plugin/

    This is based on quirksmode BrowserDetect a wrap for jQuery browser/os detection plugin.

    For keen readers:
    http://www.stoimen.com/blog/2009/07/16/jquery-browser-and-os-detection-plugin/
    http://www.quirksmode.org/js/support.html

    And more code around the plugin resides here: http://www.stoimen.com/jquery.client.plugin/jquery.client.js

提交回复
热议问题