0

I'm going to detect webview or browser in android I want to display a banner in Android browsers. Which users click to install app. And I do not want to display this banner on the webview android.

I use this:

    <?php
     if ($_SERVER['HTTP_X_REQUESTED_WITH'] == "app.mypackage") {
      echo 'WebView'; }
      else {
     echo 'no-WebView';
     }
   ?>

But that does not work, and displays the 'webview' in browser and webview app

There is another way to do this?

2
  • 2
    let me give you a little hint from the end-user perspective: don't - i hate websites that display a huge banner for their app, blocking a lot of content and requiring pixel-precise tapping skills. just mention the app somewhere on the landing page and be done with it - if i cared about having the app installed, i'd have the app installed. Mar 11, 2019 at 6:32
  • I just want to put a small banner from the Landing page (donwload app) link at the bottom of the page. Mar 11, 2019 at 6:46

1 Answer 1

0

Not accurate but you could use Javascript to check the platform that the site is running on using:

navigator.platform

Possible result(s) of using this property will include:

  • HP-UX
  • Linux i686
  • Linux armv7l (Android)
  • Mac68K
  • MacPPC
  • MacIntel
  • SunOS
  • Win16
  • Win32
  • WinCE
1
  • How can I use this to display a banner (just) in (Android browsers)? Mar 11, 2019 at 7:06

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.