To use PHP to implement the UA whitelist, you must be able to match the regular expressions of basically all browsers and major search engine spider UA. This problem may be complicated. let's see if anyone can solve it. To use PHP to implement the UA whitelist, you must be able to match the regular expressions of basically all browsers and major search engine spider UA.
This problem may be complicated. let's see if anyone can solve it.
Reply content:
To use PHP to implement the UA whitelist, you must be able to match the regular expressions of basically all browsers and major search engine spider UA.
This problem may be complicated. let's see if anyone can solve it.
var userAgent = navigator.userAgent.toLowerCase();// Figure out what browser is being usedjQuery.browser = { version: (userAgent.match( /.+(?:rv|it|ra|ie)[/: ]([d.]+)/ ) || [])[1], safari: /webkit/.test( userAgent ), opera: /opera/.test( userAgent ), msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ), mozilla: /mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};
For your reference, http://www.bkjia.com/jQuery/449138.html
Improve the thinking of the other two clues,
1. in the earliest implementation of jQuery, UA detection seems to be based on regular expression detection, and later compatibility code uses the "test" method;
2. JavaScript advanced programming, with such code in mind. the sample code of the third edition is on page 233.
Add:
This site can find the vast majority of browsers and search engine spider UA: http://www.useragentstring.com/pages/useragentstring.php
Ie ua description: https://msdn.microsoft.com/en-us/library/ms537503 (v = vs.85). aspx
FireFox UA description: https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
Chrome UA description: https://developer.chrome.com/multidevice/user-agent