<span id="Label3"></p><p><p>Mobile pages in different devices, different operating systems, different operating environment can cause a variety of non-encountered pits, compared to the former IE6 pit more. The following is a description of the 4 types of specific common pits:</p></p><p><p><strong>1. appearance</strong></p></p><p><p><strong>A, Page Height Rendering error</strong></p></p><p><p></p></p><p><p>In each mobile browser often appear this page height 100% rendering error, The low end of the page and the system comes with the navigation bar coincident, the height is not correct we need to reset it, reset it by JavaScript code:</p></p> <ol class="dp-c"> <ol class="dp-c"> <li class="alt">Document.documentElement.style.height = window.innerheight + <span class="string">' px ';</span></li> </ol> </ol><p><p><strong><span lang="EN-US">B, Overlay Area Highlighting</span></strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In some Android models, click on a section of the page may appear in the yellow box of the second flash, which is the default custom style of some models of the system itself, to the element a CSS style reset:</p></p> <ol class="dp-css"> <ol class="dp-css"> <li class="alt">-webkit-tap-highlight-<span class="keyword">Color:rgba (<span class="value">0,0,<span class="value">0,0);</span> </span> </span></li> </ol> </ol><p><p><strong><span lang="EN-US">2. behavior</span></strong></p></p><p><p><strong><span lang="EN-US">A. event cannot be triggered</span></strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In the <span lang="EN-US">context of some Android models where events cannot be triggered and forms cannot be entered, we set the style for elements that require input or triggering events:<span lang="EN-US">-webkit-transform:translate3d (0,0,0), however, the new version has directly fixed the Problem. </span></span></p></p><p><p><strong><span lang="EN-US">B<span lang="EN-US">: The active effect is not compatible</span></span></strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>The css:active pseudo-state effect is not compatible with the Android 4.0 version, and we bind an empty anonymous method to the Element's Touch Series event (touchstart/touchend/touchmove):</p></p> <ol class="dp-css"> <ol class="dp-css"> <li class="alt">var Element=document.getelementsbyid ("btnshare");</li> <li>Element.addeventlistener (' touchstart ', function () {},false);</li> </ol> </ol><p><p></p></p><p><p><strong><span lang="EN-US">3. Application</span></strong></p></p><p><p><strong><span lang="EN-US">A, Browser crashes</span></strong></p></p><p><p><span lang="EN-US"></span></p></p> <ol class="dp-xml"> <ol class="dp-xml"> <li class="alt">var <span class="attribute">act = <span class="attribute-value">function () {</span> </span></li> <li>Window.removeeventlistener (' devicemotion ', act);</li> <li class="alt">};</li> <li>Window.addeventlistener (' devicemotion ', act,false);</li> </ol> </ol><p><p>The Unbind function is written in the event processing to cause the crash of the Xiaomi phone, so we do not write the time of the Unbind in event Processing.</p></p><p><p><strong>B, pre-load, AutoPlay Invalid</strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>As shown in the table above, after a simple test to find that preload, the effectiveness of AutoPlay is affected by the operating system, browser (webview), version, etc., Apple Official rules must be manually triggered by the user to load audio, then we capture a user input, let the audio load implementation preload:</p></p> <ol class="dp-c"> <ol class="dp-c"> <li class="alt"><span class="comment">Play and pause it once</span></li> <li></li> <li class="alt">Document.addeventlistener (<span class="string">' Touchstart ', <span class="keyword">function () {</span> </span></li> <li></li> <li class="alt">document.getElementsByTagName (<span class="string">' audio ') [0].play ();</span></li> <li></li> <li class="alt">document.getElementsByTagName (<span class="string">' audio ') [0].pause ();</span></li> <li></li> <li class="alt">});</li> </ol> </ol><p><p><strong><span lang="EN-US">C. cannot play multiple audio simultaneously</span></strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In Android device, play after one audio will interrupt the previous audio, but not synchronized playback, This is the current system senior decision, we only take the elegant down the right way to let Android choose a different style of audio and video before and after the switch playback instead of playing simultaneously, to achieve with the expected close audio Effect.</p></p><p><p><strong>D, partial scrolling is not supported</strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>The Overflow:scroll style setting ScrollBar is not valid for elements other than the body (HTML) element below the Android 4.0 version, there are two solutions:</p></p><p><p>1, skillfully with the layout directly set the style scroll bar on the body (html), the other elements "illusion scrolling."</p></p><p><p>2, using iscroll, self-write js control translate, scrolltop Simulation.</p></p><p><p><strong><span lang="EN-US">4. System <span lang="EN-US">/hardware</span></span></strong></p></p><p><p><span lang="EN-US">A, weird suspension of the form</span></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In some <span lang="EN-US">Android models the input box may appear weird superfluous flyout, after observation and testing found only <span lang="EN-US">input:password type of input box exists, then we just use <span lang="EN-US">the Input:text type of input box and through the style <span lang="EN-US">-webkit-text-security:disc; Hide input password to Resolve. </span></span></span></span></p></p><p><p><strong><span lang="EN-US">B, error appears scroll bar</span></strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In the Game inline page appears the scroll bar should not appear, and the content does not exceed the content area width, after the test Overflow:hidden invalid, through a series of attempts to use the ancient <body scroll= "no" > Writing solution, Try a different way of writing and attributes will be a surprise oh!</p></p><p><p><strong>C, Link Open System Browser</strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>It is a very bad experience to have a click-through link to invoke the System browser in some Android models that are WebView In-game. Then we try to add the target= "_blank" property to this element is possible to resolve, if it is not resolved then need to modify the iOS or Android native system Functions.</p></p><p><p><strong>D, Flex box is not compatible</strong></p></p><p><p><span lang="EN-US"></span></p></p><p><p>In the game embedded WebView in the case of the Flex box layout is incompatible, the figure shows that the following part of the navigation dislocation, although the previous careful review of the Flex box compatibility, but in the game embedded page can not be determined that its call system browser version and compatibility, resulting in an error, So we write the full history version of the 3 kinds of Flex box Solution. Then we think in the process of writing a page or in a conservative and stable way to write style can reduce the Trouble.</p></p><p><p><strong>Faced with so many pits, there are all kinds of already and unknown pits, the time can not be finished, more unlikely to have a solution, we need to learn how to solve the Pit:</strong></p></p><p><p>To solve the pit you need to have a strong executive power, through the constant attempt to explore the unknown problems, then what are the general steps and techniques we will try?</p></p><p><p><strong><span lang="EN-US">1, First we need to locate the problem, we can use the following methods:</span></strong></p></p><p><p><span lang="EN-US">A,<span lang="EN-US">Dom Isolation location method</span></span></p></p><p><p>Dom <span lang="EN-US"> <span lang="EN-US">elements</span> that are</span> constantly isolated from a wide range to a small range to isolate and trigger problems</p></p><p><p><span lang="EN-US">B, style,<span lang="EN-US">js Culling method</span></span></p></p><p><p>Constantly remove some <span lang="EN-US">js,<span lang="EN-US">css Watch debugging check whether it is caused by some <span lang="EN-US">js,<span lang="EN-US">CSS Properties problems</span> </span> </span> </span></p></p><p><p><span lang="EN-US">C, Multi-run Environmental Testing method</span></p></p><p><p>Test in a multi-environment to see if it is caused by a specific environment</p></p><p><p><span lang="EN-US">D,<span lang="EN-US">PC and mobile phone joint debugging method</span></span></p></p><p><p>United <span lang="EN-US">PC and mobile phone positioning, such as: <strong><span lang="EN-US"><span lang="EN-US"><span lang="EN-US"> <span lang="EN-US"><span lang="EN-US">remote debugging</span></span> via Mac Iphone/ipad</span></span></span></strong> </span></p></p><p><p><strong><span lang="EN-US">2, we can try to solve the problem in the following ways:</span></strong></p></p><p><p><span lang="EN-US">* try, turn your mind around and solve</span></p></p><p><p><span lang="EN-US">* Graceful down right, differentiated treatment, communication</span></p></p><p><p><span lang="EN-US">* Search and ask <span lang="EN-US"></span> questions ...</span></p></p><p><p>and the following thinking:</p></p><p><p><span lang="EN-US">* Alternative</span></p></p><p><p><span lang="EN-US">* Detour</span></p></p><p><p><span lang="EN-US">* Split <span lang="EN-US">...</span></span></p></p><p><p><strong>3, in the process of solving the problem, we need to learn to use search and communication resources to solve the problem:</strong></p></p><p><p><span lang="EN-US">A,<span lang="EN-US">Google</span></span></p></p><p><p><span lang="EN-US">B,<span lang="EN-US">StackOverflow</span></span></p></p><p><p><span lang="EN-US">C, colleagues, friends,<span lang="EN-US">QQ group, forum, etc.</span></span></p></p><p><p><span lang="EN-US">Google and <span lang="EN-US">StackOverflow make it easier for you to quickly search for more accurate information about problems, as well as friends <span lang="EN-US">QQ groups, forums and so on so that you can directly communicate with others about the problem and solutions. </span></span></span></p></p><p><p><strong>After discovering and solving the problem, it is more important to learn how to summarize the Problem:</strong></p></p><p><p><span lang="EN-US">A, summarize record the problem to produce the condition, the solution method and the solution process</span></p></p><p><p><span lang="EN-US">B, as far as possible to analyze the principle, the conditions produced, avoid repeating</span></p></p><p><p><span lang="EN-US">C, share to more people</span></p></p><p><p>Endless pit, Walk more people, summed up the share of more, the pit is more and more flat</p></p><p><p>We summarize the records of the problem at the same time, organized a mobile tip, record problems and some pits, although not perfect at present but hope to share to more people also hope that more people can participate in the Improvement.</p></p><p><p>Mobile-page FAQ</p></p></span>
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