I've been looking at enough blogs so I'm pretty sure how it's coded... but none of them seem to mention where the javascript injection goes in the Obj-C code? Basically all I want to do is get rid of a header on all the pages the user can navigate to (or at least the page that initially loads... I'll worry about subsequent pages later if it's an issue. keep it simple, stupid ). Here's the code I have:
[self stringByEvaluatingJavaScriptFromString:@"document. getElementById('login').childNodes[1].innerHTML=''"];
I'm just having a hell of a time finding a place where it should actually work. I attribute it mostly to not fully understanding UIWebView. I figured I'd post this here and then in the meantime read up on how that works and maybe figure it out on my own.
Your javascript code should be executed one your whole HTML document has been loaded (and all its DOM objects).
Thus you should paste your
stringByEvaluatingJavascriptFromString
call in the UIWebView's delegate method- (void)webViewDidFinishLoad:(UIWebView *)webView
(of course you need to implement this code in an object that will be set as the delegate of the UIWebView, as for any delegate method and for every time you use the delegate pattern)