How to detect the mobile app

If you want to detect that an user browse your website with the application you can use 3 way :

  • the body class wpappninja
  • the HTTP header HTTP_X_WPAPPNINJA
  • the PHP function is_wpappninja()

CSS

Show an element only on the app:

.myAppElement {
    display:none;
}

body.wpappninja .myAppElement {
    display:block;
}

Hide an element only on the app:

.myWebsiteElement {
    display:block;
}

body.wpappninja .myWebsiteElement {
    display:none;
}

PHP

Show an element only on the app:

if (isset($_SERVER['HTTP_X_WPAPPNINJA'])) {

    // in app

}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us