Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kwjohns

macrumors 6502a
Original poster
Jul 4, 2007
700
12
I have a UIWebView linking to a mobile Twitter page and it shows this bar at the top. I'm wanting to remove it so it won't limit viewing space but not having any luck. I have attempted to pass javascript to the page after loading to hide it but it doesn't work.

I'm using the example here:

Code:
- (void)hideUnwantedHTML{

[self.webView stringByEvaluatingJavaScriptFromString:@"var script = document.createElement('script');"  

    "script.type = 'text/javascript';"  

    "script.text = \"function hideID(idName) { "  

    "var id = document.getElementById(idName);"  

    "id.style.display = 'none';"

    "}\";" 

    "document.getElementsByTagName('head')[0].appendChild(script);"];  

[self.webView stringByEvaluatingJavaScriptFromString:@"hideID('brand_bar');"];    
}

And

Code:
- (void)webViewDidFinishLoad:(UIWebView *)webView {

[self hideUnwantedHTML];

}

I've also tried it with getElementByClassName and getElementByTagName and none work. Any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.