Turn: Mobile platform Front end development summary (for iphone,android and other mobile phones)

Source: Internet
Author: User

Original connection: http://binghe19890918.blog.163.com/blog/static/117904124201311945714174/  Mobile platform front-end development refers to high-end smartphones, such as the iphone, Android) do site adaptation is WebApp, is not for ordinary mobile phone development WAP 2.0, so before reading this article, you need to webkit kernel browser have a certain understanding, need to HTML5 and CSS3 have a certain understanding.  1, first of all, let's take a look at some of the private meta tags in the WebKit kernel, which play a very important role in developing WebApp          (1) <meta Content= "Width=device-width; initial-scale=1.0; maximum-scale=1.0; User-scalable=0 "Name=" viewport "/>        (2) <meta content=" yes "name=" Apple-mobile-web-app-capable "/>        (3) <meta content=" Black "name=" Apple-mobile-web-app-status-bar-style "/>        (4) <meta content=" Telephone=no "Name=" Format-detection "/>         First meta tag means: Force the width of the document to remain 1 of the width of the device : 1, and the maximum width of the document is 1.0, and does not allow the user to click on the screen to zoom in, especially to note that the settings of multiple properties in the content must be separated by semicolons + spaces, if not the specification will not work.         The second meta tag is the safari private meta tag in the iphone device, which says: Allow full-screen mode browsing;        The third meta tag is also the iphone's private label, which specifies the iphone in SafariThe style of the top state bar;        Fourth meta tag means: Tell the device to ignore the number on the page as the phone number  2, how to remove the recognition of the email address in the Android platform       The iOS WebApp API's classmates know that iOS provides a meta tag that disables the automatic recognition of iOS phone numbers in a page. In iOS is not automatically recognize the email address, but on the Android platform, it will automatically detect the email address, when the user touch to this email address, Android will pop up a box prompting the user to send a message, if you do not want Android automatically identify the email address on the page, You might add a meta tag to the head          <meta content= "Email=no" name= "Format-detection"/>  3, how to remove control strips for input URLs in iOS and Android       your boss or PD or interaction designer may ask you: can we make our webapp more like Nativeapp, I don't want the user to see the control bar that entered the URL? The answer is that it can be done. We can use a simple JavaScript code to achieve this effect        setTimeout (scrollto,0,0,0); Please note that This code must be placed in the window.onload to be able to work properly, and your current document content must be higher than the height of the window, this code can be effectively executed.  4, how to prevent users from rotating devices       I have also wanted to prohibit users from rotating devices, and want to do something like some clients: only in portrait mode or Landscape mode can function properly. But now I can be very responsible to tell you: forget it! In the mobile version of the WebKit do not! At least the Apple WebApp API has said: In order for users to navigate through the Web in Safari, we must ensure that the user's device is in any direction, and Safari is able to display the content of the Web page (that is, adaptive) as normal. So we prohibit developers from blocking browser Orientationchange events, it seems Apple's starting point is correct, Apple is really not a normal apple. iOS has banned developers from blocking Orientationchange events, andWhere's roid? Sorry, I didn't find any information that Android prohibits developers from blocking browser Orientationchange events, but on the Android platform, it does not stop.  5, how to detect the user is launched through the main screen of your webapp      read the Apple WebApp API, the students know that iOS provides Safari with a feature to add a home screen to the current page, press Iphone\ipod The small plus sign in the \ipod Touch Bottom tool, or the small plus sign on the left side of the ipad, adds the current page to the main screen of the device and automatically adds a start icon to the current page on the main screen of the device, which allows you to start your webapp quickly and easily by clicking on the launch icon. The biggest difference between WebApp and browser-launched from the main screen is that it clears the toolbars above and below the browser, so your webapp is more like Nativeapp. Another difference is that the window is a standalone property of the Navigator child object in the image. When the browser accesses the site directly in iOS, Navigator.standalone is false and Navigator.standalone is true when WebApp is started from the main screen. We can tell by navigator.standalone this property whether the user is currently accessing our WebApp from the main screen. Never add to the main screen in Android!  6, how to turn off iOS keyboard auto capitalization       We know that in iOS, when the virtual keyboard pops up, the keyboard is the first capitalization feature by default, depending on the business scenario, we may need to turn this feature off, Mobile version WebKit provides the input element with the Autocapitalize property, which turns off the default initial capitalization of the keyboard by specifying autocapitalize= "off".  7, how to turn off Android/iphone browser automatically recognize numbers for phone numbers       Safari on iphone (also some webkit Android phone browser) Automatically adds a phone link to a number string that looks like a phone number (including formatting that has been added to hyphens or parentheses), and then asks the user if they want to dial the number. If you don't want to turn on this automatic recognition, you can turn it off: <meta name= "format-detection" content= "Telephone=no" /> If you turn off auto-recognition and want some phone numbers to link to your iphone's dialing capabilities, you can declare a phone link by: <a href= "tel:12345678910" >12345678910</a>   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.