[Check for missing traps] highlights 01 and 01

Source: Internet
Author: User

[Check for missing traps] highlights 01 and 01

Directory 1. jquery: Random Number generated by jsonp; browser type detection; element removal; prohibit Copying on the mobile end; select text; use of the anchor in markdown

 

I. jsonp generates random numbers

Use jquery's ajax method to send cross-origin requests. The request url contains a random number. The Code is as follows:

 1     $.ajax({ 2       type: "GET", 3       url: url, 4       dataType: "jsonp", 5       cache:true, 6       jsonpCallback: 'callback', 7       success: function(data) {), 8          //.... 9       },10       error: function() {11           //....12       }13     });    

Check the jquery manual to find that when datatype is jsonp, the default cache value is false. So passSet cache to true.

 

Ii. Check the browser type
1 var _ ua = navigator. userAgent. toLowerCase (); 2 window. UA = {3 weixin:/micromessenger /. test (_ ua), 4 android:/android /. test (_ ua), 5 ios:/\ biphone. * mobile | \ bipod | \ bipad | \ bmac OS x /. test (_ ua), 6 is360mse:/360 Aphone Browser | QHBrowser/I. test (_ ua) // 360 Browser (qhbrow.ios; 360 Aphone Browser Android) 7 };

 

 

3. Remove Elements

In Native JS, the methods for removing elements include removeChild and removeNode (IE only ). You cannot directly remove yourself.

Work und: Find the parent node of the element and then callRemoveChild ()Remove it.

 

4. Prohibit text copying and selection on the Mobile End
1 *{2 -webkit-user-select: none;3 user-select: none;4 }

 

 

5. Use of the anchor in markdown

1. A jump link is recommended.

[Description] (# jump)

2. Mark the position to jump to. markdown also supports html syntax.
<Span id = "jump"> jump here: </span>

 

Related Article

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.