开发者

Disabled format-detection for iPhone/iPad webapp not working

I have a webapp that displays many long numbers recognized as telephone numbers on iPhone / iPad. I used the meta tag mentioned in apple's referen开发者_如何学Goce to disable it:

<meta name="format-detection" content="telephone=no"/>

But this does not work if i load or reload the page normally. When I am reloading a part of the page with ajax, it suddenly works and the numbers are normal text. But when i reload the page, the numbers are links again. This happens also if the ajax loaded content is exactly the same that was at the place before the ajax request.

If i view the page in the browser (not as webapp) it works right from the beginning.

Do you know why this is happening, and how i can fix it? Is there any other way to force numbers to not being links.

Thanks for any help.


Try and add this to YourProjectAppDelegate.m

// ...

- (void)webViewDidStartLoad:(UIWebView *)theWebView 
{
    theWebView.dataDetectorTypes = UIDataDetectorTypeAll ^ UIDataDetectorTypePhoneNumber;    
    return [ super webViewDidStartLoad:theWebView ];
}

// ...

Did the trick for me..


I have had a similar problem where an embedded web page worked fine in a browser, but the problem occurred when embedded in an app. This was due to the meta tag being over written by settings in the app itself, see http://developer.apple.com/iphone/library/documentation/uikit/reference/UIKitDataTypesReference/Reference/reference.html#//apple_ref/doc/c_ref/UIDataDetectorTypePhoneNumber.

May help?


You might need to go through the entire process of bookmarking the app to the Home Screen to force the cache to update.

You also have the correct code for format-detection according to Apple's guide to Apple-specific meta tags except they do not have the meta tag as self closing with trailing slash:

<meta name="format-detection" content="telephone=no">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜