Embedding Discourse in an app without custom header


I have my Discourse forums embedded in an iOS app. I have a custom header but I don’t want it visible when viewing in the app. I only want it visible when viewing in Safari. It is possible to do this?

(Руслан Корнев) #2

May I ask you? How did you integrated Discourse in iOS app?


It’s in a UIWebView and I’d like it to display without the header in there.


Well I got it working almost perfectly. I gave the header an ID and hide it using some javascript when the page loads. The only problem with this method is that the header still appears for a second before being hidden.

- (void)webViewDidFinishLoad:(UIWebView *)webView
	[webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('my-navigation').style.display = 'none'"];

(Руслан Корнев) #5

I’am not an iOS developer, but i think you can achieve this by checking user_agent or screen resolution with Javascript or with CSS using css media by modifying discourse template through admin section.


Does anyone know if there is a way to trigger a different HTML/CSS header through a URL parameter? That would work fine since Discourse doesn’t need to reload the page. The only issue with my solution is that the header is visible for a second before hidden.

(Dean Taylor) #7

Actually the preview URL pretty much does what you are requesting, from /admin/customize/css_html:


Try testing that out and see if it fits your needs.

Obviously you wouldn’t need to “Enable” it, just preview.


That seems to work perfect! It works fine without enabling.