I have a UIWebView
in which I load a NSURLRequest
. I do not have full control over the html for the page shown but I do know it will contain an element which has an id I happen to know beforehand. Let's say it is submmit_form_button
.
I don't want the user of the app to see this element. I want to hide it before it appears to the user in the UIWebView
.
What is the best option to do that? Where in the controller that shows the UIWebView
should I put the code that will solve this?
I am aware that I can use Javascript for this. I am more concerned about how can I approach this in the context of a native iOS app that shows a UIWebView
which gets it's html from an external source.
Following the lead from the comment by @Ric I solved the problem with
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('submmit_form_button').style.display = 'none'"];
}