If you have a paragraph in your Web page, the content of the middle content is Www.yesareno.com,UIWebview will automatically identify you as http:// Www.yesareno.com, of course, most of the cases are good, but there are some special cases, you do not like the www.yesareno.com to identify as hyperlinks (that is, click No response, regardless of the abnormal needs of it), how to achieve it?
</pre><p></p><p> below is the source code for the Web page: </p><p></p><pre name= "code" class= "HTML" ><body><div id= "Content" ><p><span style= "font-family: Microsoft Ya hei, ' Microsoft Yahei '; font-size:28px; " > If you need help, please go to the official website www.yesareno.cn resolve. </span></p><p><br/></p></div></body>
When you click Www.yesareno.com in the Web page, the WebView proxy is called:
(BOOL) WebView: (UIWebView *) WebView shouldstartloadwithrequest: (nsurlrequest *) Request Navigationtype: ( Uiwebviewnavigationtype) Navigationtype {//Determine if we want the system to handle it. Nsurl *url = Request. URL;}
At this point the print Url.schema is HTTP, which is the HTTP WebView added. How is that broken?
After reviewing the document, it was found that WebView has a property that automatically detects the data, that is, Datadetectortypes, which includes
typedef ns_options (Nsuinteger, uidatadetectortypes) { Uidatadetectortypephonenumber = 1 << 0, // Phone number detection uidatadetectortypelink = 1 << 1, //URL detection #if __iphone_4_0 <= __ iphone_os_version_max_allowed uidatadetectortypeaddress = 1 << 2, //Street address detection uidatadetectortypecalendarevent = 1 << 3, //Event detection#endif Uidatadetectortypenone = 0, //No detection at all uidatadetectortypeall = Nsuintegermax //All types};
See these, presumably everybody already understood half of it, the simplest rough way is to set the Datadetectortypes property to Uidatadetectortypenone can be.
Then run the program, click Www.yesareno.com, will not jump.
Little tricks, essays are recorded.
iphone development-uiwebview Turn off auto-detect data