如何检测LinkdeIn,Skype默认浏览器?

时间:2019-09-18 08:17:14

标签: javascript jquery html html5-video

我有一个简单的部分,当用户通过LinkedIn浏览器,Skype浏览器和其他默认移动浏览器打开我的应用程序时,我想在其中显示不同的内容。

<audio id="audioplayer" playsinline controls loop autoplay hidden>
  <source src="audio/muzyka_meed_loop.mp3" type="audio/mpeg"> 
  Your browser does not support the audio element.
</audio>

<video id="videoplayer" playsinline="" muted="" autoplay="" movieid="1" src="https://meed.audiencevideo.com/videos/mena.mp4?rand=0.33113854266601805" style="opacity: 1;" class="ended"></video>
if (navigator.userAgent.match(/Android/i) ||
  navigator.userAgent.match(/webOS/i) ||
  navigator.userAgent.match(/iPhone/i) ||
  navigator.userAgent.match(/iPad/i) ||
  navigator.userAgent.match(/iPod/i) ||
  navigator.userAgent.match(/BlackBerry/) ||
  navigator.userAgent.match(/Windows Phone/i) ||
  navigator.userAgent.match(/ZuneWP7/i)
) {
  var aud = document.getElementById("audioplayer");
  var vid = document.getElementById("videoplayer");

  if (vid.paused == true) {
    if (aud.paused == false) {
      aud.pause();
    }
  } else if (vid.paused == false) {
    if (aud.paused == true) {
      aud.play();
    }
  }

  if (vid.muted == true) {
    if (aud.muted == false) {
      aud.muted = true;
    }
  } else if (vid.muted == false) {
    if (aud.muted == true) {
      aud.muted = false;
    }
  }
}

除LinkedIn,Skype浏览器外,我能够检测到所有其他移动浏览器。我需要在代码中更改为什么才能检测到LinkedIn和Skype默认浏览器?

0 个答案:

没有答案