0

Hi i want to detect if website is opened on webview or in a browser. The php code which works is:

<?php if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) == "com.website.reader") { ?> 
<p> it works </p> 
<?php } ?>

I want to check also it with javascript but when i tried to check it by getting headers like that:

    var headerAppend = document.querySelector(".headers-append");

    var req = new XMLHttpRequest();
    req.open('GET', "com.woblink.reader", false);
    req.send(null);
    var headers = req.getAllResponseHeaders();

I got only "client via: shouldInterceptRequest content-length: 2582 content-tpe: text/html"

How to achieve it also in JS? User agent doesn't work.

Dawid Kwiatoń
  • 157
  • 2
  • 13
  • `webview` is used by several browsers while Firefox for example uses `Gecko`. So you simply need to find out the clients browser as explained here: https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser/9851769 – messerbill Nov 14 '18 at 16:11
  • Possible duplicate of [How to detect Safari, Chrome, IE, Firefox and Opera browser?](https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser) – messerbill Nov 14 '18 at 16:11

0 Answers0