XF 2.1 Hide navigation using CSS based on user agent

Amin Sabet

Well-known member
Would greatly appreciate if someone can help me with this. I have apps for my sites which use the GoNative.io platform, which provides the following information to me so that I can recognize traffic coming from users of the app:

How do I detect usage coming from my apps?
Updated on November 8, 2018
You may recognize traffic coming from the app by looking at the user agent.
We append the following strings to the end of the user's default user agent on their device.
iOS app - we append "GoNativeIOS/1.0 gonative"
Android app - we append "GoNativeAndroid/1.0 gonative"

The user agent comes across in the headers of each HTTP request coming from the app. You can then recognize the request is coming from the app by checking if it contains "gonative". This is useful if you want to serve different CSS, JS, or other resource files only in your apps, but not your regular website.
You may also access the user agent directly via javascript with navigator.userAgent. To filter logic in javascript, you might use:
if (navigator.userAgent.indexOf('gonative') > -1) {
// do something
}

Is there some way I can use CSS to hide navigation from users who are on the app? The app is similar to a web wrapper but has its own navigation built in, so I don't need the forum navigation to show. Thanks in advance!
 
Top Bottom