Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
721 views
in Plugins by
Perhaps somewhere in the qa-theme i have to do this, but how can i test if the user is brwsin gmmy qa website via an android device ( so I can direct him/her to download the app?)

1 Answer

+1 vote
by
selected by
 
Best answer

Something like this should be enough:

function doctype() {
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
        if (strpos($userAgent, 'android') !== false) {
            echo '<div>Download app link</div>';
        }
    }
    qa_html_theme_base::doctype();
}
 
by
Worked without any issue, Thank you
...