Search code examples
iosuiwebviewgoogle-groups

Hide header with google groups inside UIWebView


I'm displaying google groups view inside my UIWebView window but it displays the header with options to other google services. Is there a way to hide the header and just display the google groups content ?

This is the URL I'm using ...

https://groups.google.com/d/forum/MyAppGroupName

enter image description here


Solution

  • Use UIWebViewDelegate method webViewDidFinishLoad and run this JS script in

    - (void)webViewDidFinishLoad:(UIWebView *)webView {
    NSString *script = [NSString stringWithFormat:@"document.getElementById(\"og_head\").style.display='none';"];
    [webView stringByEvaluatingJavaScriptFromString:script];
    }