简体   繁体   中英

How to modify the content load from the url with UIWebView in iOS?

我在webview中加载了带有URL的网页,并且想用“ iOS”替换该页面中的所有“ android”一词,我该怎么做?

You can use UIWebView 's -stringByEvaluatingJavaScriptFromString: method to modify your HTML once it has been loaded:

[webView stringByEvaluatingJavaScriptFromString:
  [NSString stringWithFormat:@"document.getElementById('android').innerHTML = iOS]];

for sample link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM