Add check for navigator userAgent

pull/495/head
Moses Gitau 2020-06-07 13:45:27 +03:00
parent ac81abf7fd
commit d15fb391f8
1 changed files with 9 additions and 7 deletions

View File

@ -3,15 +3,17 @@ var chromeMediaSource = 'screen';
var sourceId;
var screenCallback;
var isFirefox = typeof window.InstallTrigger !== 'undefined';
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var isOpera = !!window.opera || (navigator.userAgent && navigator.userAgent.indexOf(' OPR/') >= 0);
var isChrome = !!window.chrome && !isOpera;
if(window.addEventListener){
window.addEventListener('message', function (event) {
if (event.origin != window.location.origin) {
return;
}
onMessageCallback(event.data);
});
}
// and the function that handles received messages
function onMessageCallback(data) {