Mobile front-end development, that is, WebApp, mainly for the iphone, Android and other high-end mobile phones.
1, Prohibit user screen rotation.
This can be sure to do not, before because there are items need to prohibit screen rotation, so online access to a large number of data, found there is no solution, in the mobile version of WebKit can not do. The Apple API also shows that, in order for users to navigate the Web in Safari, we have to ensure that the user's device is in any One direction, and Safari is able to display the content of the Web page (ie, adaptive) in a normal So we prohibit the developer from blocking the browser's Orientationchange event, so iOS is forbidden to block the Orientationchange event, and Android is the same, and can not prevent screen rotation, so in the webapp is not done. However, the Orientationchange event can be used to determine the direction, the horizontal screen display mode and vertical screen display mode, written in two styles.
2. Private meta tag of WebKit kernel
- <meta Content="width=device-width; initial-scale=1.0; maximum-scale=1.0; User-scalable=0 " name=" viewport " />
- <meta Content="Black" name="Apple-mobile-web-app-status-bar-style" / >
- <meta Content="yes" name="apple-mobile-web-app-capable" / >
- <meta Content="Telephone=no" name="format-detection" />
(1), the main I is to force the width of the document and the device to maintain a width of 1:1, the maximum width of 1.0, prohibit screen scaling.
(2), the iphone's private label, the iphone top status bar style.
(3), this is also the iphone private label, allowing full screen browsing.
(4), prohibit the number automatically recognized as the phone number, this is more useful, because a string of numbers on the iphone will be shown in blue, style added to other colors is not effective.
3. Remove Android Auto-recognition email address
Android has an automatic mailbox recognition feature, but Apple doesn't. To remove the mailbox recognition feature, add a meta tag to the head.
- <meta Content="Email=no" name="format-detection" />
4. Remove the URL address bar for Android and iOS
- SetTimeout(scrollTo,0,0,0);
Put this sentence in the window.onload.
(Reference: Web Front end http://www.linzenews.com/program/web/2773.html)
Mobile front end Development summary