Disable link in UIWebView in appearance and function

Posted by Peter on Stack Overflow See other posts from Stack Overflow or by Peter
Published on 2010-12-22T14:51:39Z Indexed on 2010/12/22 14:54 UTC
Read the original article Hit count: 187

Hello,

I wish to disable the href links on a UIWebView. First, I want the look of the link to change so the user doesn't think it is clickable. Second, I want the actual link to not be able to be tapped. I do not want to try webView:shouldStartLoadWithRequest:navigationType: since that not change the appearance of my links.

I found this answer: Disabling visible links in UIWebView

But the above hasn't worked for me. This is my code:

NSString* s=[[NSString alloc] initWithFormat:@"for (a in document.getElementsByTagName(\"a\")) {a.href = \"\";}"];
[myWebView stringByEvaluatingJavaScriptFromString:s];

I've been working on this for hours, any suggestions are appreciated! Thanks!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch