jquery - detecting mobile browser without user agent sniffing -


which approach more reliable detect mobile browser?

  • ua sniffing

  • jquery's width()

as understand ua sniffing not reliable.

i need change html page according width of mobile device viewing page. can't media queries alone.

you can use mobile detect js library this. take note of warning:

// warning:  //   these javascript-based device detection features may work  //   newest generation of smartphones, such iphone,  //   android , palm webos devices. //   these device detection features may not work older smartphones  //   had poor support javascript, including  //   older blackberry, palmos, , windows mobile devices.  //   additionally, because javascript support extremely poor among  //   'feature phones', these features may not work @ on such devices. //   better results, consider using server-based version of code,  //   such java, aps.net, php, or ruby. 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -