UIWebview Action Alert
If there is an <a href></a> tag in the html that is being loaded in an UIWebView, then touching that link for few seconds would trigger an alert showing ‘Action’ or the alternate text provided for the link.
If we need to disable it, then we need to set
document.documentElement.style.webkitTouchCallout=”none”;
This can be called in the onload event of the html <body> tag which is being loaded in UIWebview. Put this piece of Javascript before the <body> tag
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>Hide Action Alert In UIWebView</title> <script type="text/javascript"> function OnLoad() { document.documentElement.style.webkitTouchCallout = "none"; } </script> </head> <body onload="OnLoad()"/> </body> </html>
“… an alert showing ‘Action’ or the alternate text provided for the link.”
I’ve tried using the title attribute of the anchor a tag, but the UIWebView still shows as its title the text between the opening and closing a tag followed by the URL in the href attribute.
How can I keep the callout but customize what shows up there?
You will also be able to do this through CSS:
body { -webkit-touch-callout: none; }
This and other Webkit/Safari/iPhone specific CSS can be found in Apple’s documents at http://developer.apple.com/DOCUMENTATION/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html
Name (required)
Mail (will not be published) (required)
Website
Please note: JavaScript is required to post comments. Spam protection by WP Captcha-Free