Sunday, January 5, 2014

Web part displays an invalid link on UIWebView

Such as using UIWebView load "www.163.com", then the top 163 most connections are invalid.
The reason is that this part of the connection need to restart a window.


The question now is, how to make UIWebView respond to this part of the connection.
Reply:
You mean because the links will restart a window
The UIWebView does not automatically help you restart a window?
So the new link can not be linked in the past?
Reply:
http://dblog.com.au/iphone-development/iphone-sdk-tip-firing-custom-events-when-a-link-is-clicked-in-a-uiwebview/
This blog is information in this regard
Reply:
Resolved, but actually there is not adopted html people, they said too risky.
 - (void) webViewDidFinishLoad: (UIWebView *) webView {
NSString * js = @ "\
var d = document.getElementsByTagName ('a'); \
for (var i = 0; i if (d [i]. getAttribute ('target') == '_blank') {\
. d [i] removeAttribute ('target'); \
} \
} \
";

[WebView stringByEvaluatingJavaScriptFromString: js];
}


blog.mikeweller.com / ... / uiwebview-doesnt-open-targetblank-links.html

Reply:
http://blog.mikeweller.com/2009/06/uiwebview-doesnt-open-targetblank-links.html
Reply:
Directly to the target using javascript to remove this idea of ​​awesome ...

No comments:

Post a Comment