Mobile web page full screen display, web page full screen display
1. Set the percentage display and adaptive.
2. meta tag settings
Ios: Correct settings
<meta name="viewport" content="width=device-width;" />
: Error settings
<meta name="viewport" content="width=device-width" />
Shown below
Cause: a semicolon is missing;
Android: Correct settings
<meta name="viewport" content="" />
If the settings are the same as those shown in Ios
Conclusion: different meta files can be displayed for different devices.
You can use the following script:
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 ('khtml ') =-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 the browser is iPhone or QQHD iPad: u. indexOf ('ipad ')>-1, // whether iPad webApp: u. indexOf ('safari ') =-1 // whether the web should program, no header and bottom};} (), language: (navigator. browserLanguage | navigator. language ). toLowerCase ()} if (browser. versions. android) {$ ("meta [name = 'viewport']"). attr ('content', "");} else {$ ("meta [name = 'viewport']"). attr ('content', "width = device-width ;");}
Principle Description: first determine whether the device is an apple or Android device, and then set meta based on different devices;