How to disable phone number linking in Mobile Safari?

前端 未结 24 1809
面向向阳花
面向向阳花 2020-11-22 16:56

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is tur

24条回答
  •  梦谈多话
    2020-11-22 17:25

    Solution for Webview!

    For PhoneGap-iPhone / PhoneGap-iOS applications, you can disable telephone number detection by adding the following to your project’s application delegate:

    // ...
    
    - (void)webViewDidStartLoad:(UIWebView *)theWebView 
    {
        // disable telephone detection, basically 
        theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;
    
        return [ super webViewDidStartLoad:theWebView ];
    }
    
    // ...
    

    source: Disable Telephone Detection in PhoneGap-iOS.

提交回复
热议问题