Determine whether functions of the new version are available in iOS compatibility.
When it comes to ios compatibility issues, the app may be 4.0, so new functions of 5.0 cannot be called;
We can determine whether the function can be called to determine:
If ([self. navigationController. navigationBar respondsToSelector: @ selector (setBackgroundImage: forBarMetrics :)]) {// if the version supports this function, call this function after 5.0 to set the background image of navigationBar. [self. navigationController. navigationBar setBackgroundImage: [UIImage imageNamed: @ "Navigetion.png"] forBarMetrics: UIBarMetricsDefault];}
How does js determine whether the client is a mobile terminal such as iOS or Android?
Judgment Principle:
JavaScript is the main language for front-end development. We can compile JavaScript programs to determine the browser type and version. There are two methods to determine the browser type in JavaScript: one is to distinguish based on the unique attributes of various browsers, and the other is to judge by analyzing the userAgent attributes of the browser. In many cases, after determining the browser type, you must determine the browser version to handle compatibility issues. However, you can only determine the browser version by analyzing the browser's userAgent.
Browser type
(1) Special browser attributes
(2) According to userAgent
Browser version
(1) According to userAgent
Mobile browser judgment
1. How to determine whether a mobile terminal uses regular match,
Match navigator. userAgent with the string AppleWebKit ***** Mobile
Android qq browser HD only supports AppleWebKit
2 mobile phone language version judgment
You can use navigator. browserLanguage to obtain the windows phone language version,
Of course, there are also compatibility differences between the hateful little mobile phone language versions, compatible with Mozilla, and AppleWebKit kernel browsers to access their language versions, it will list navigator. language
CODE:
<Script type = "text/javascript">
Var browser = {
Versions: function (){
Var u = navigator. userAgent, app = navigator. appVersion;
Return {// mobile terminal browser version information
Trident: u. indexOf ('think')>-1, // IE Kernel
Presto: u. indexOf ('presto ')>-1, // opera Kernel
WebKit: u. indexOf ('applewebkit')>-1, // Apple, Google Kernel
Gecko: u. indexOf ('gecko ')>-1 & u. indexOf ('k') =-1, // Firefox Kernel
Mobile :!! U. match (/AppleWebKit. * Mobile. */), // whether it is a Mobile terminal
Ios :!! U. match (/\ (I [^;] +; (U ;)? CPU. + Mac OS X/), // ios Terminal
Android: u. indexOf ('android')>-1 | u. indexOf ('linux ')>-1, // Android terminal or uc Browser
IPhone: u. indexOf ('iphone ')>-1, // whether it is an iPhone or QQHD Browser
IPa ...... remaining full text>
To solve the compatibility problem of the Matlab version, Will old functions not be supported in the new version?
Many functions are replaced by new functions, which can be interpreted by querying the old function name in help.