view if the user open my website a Web Clip

145 views Asked by At

How can I view if the user open my website from safari or from a Web Clip?
I try to search but I don't find that information. Thanks in advance! ;-)

1

There are 1 answers

1
pankaj sharma On

original answer Link

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
function getBrowser() {
  if( navigator.userAgent.indexOf("Chrome") != -1 ) {
    return "Chrome";
  } else if( navigator.userAgent.indexOf("Opera") != -1 ) {
    return "Opera";
  } else if( navigator.userAgent.indexOf("MSIE") != -1 ) {
    return "IE";
  } else if( navigator.userAgent.indexOf("Firefox") != -1 ) {
    return "Firefox";
  } else if( navigator.userAgent.indexOf("Safari") != -1 ) {
    return "Safari";
  } else {
    return "unknown";
  }
}
document.getElementById("demo").innerHTML = getBrowser();
</script>

</body>
</html>