0

Hi I need to detect the browser for Chrome, Firefox and IE. I searched the website and found some example.How to detect Safari, Chrome, IE, Firefox and Opera browser? However I didn't get it work. Currently, I put the alert statement to check the browser. Only the IE will show alert. If I open the page in FireFox and Chrome, the alert('line 27') and the alert ('Line 31')never show. Would someone tell me what is wrong? Thanks in advance.

There is my javascript code:

 function openFile() {

            var url = 'file://' + document.getElementById("hdURL").value; 
            alert('Open File' + url);
            var location = document.getElementById("hdURL").value;
            //https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
             if ((/*@cc_on!@*/false || !!document.documentMode) ||(!isIE && !!window.StyleMedia))
             {
                alert('line 25');


             }
             if (typeof InstallTrigger !== 'undefined'){
                alert('line 27');

            }
            if ((!!window.chrome) && (!!window.chrome.webstore)){
                alert('line 31');

            }

        }
Community
  • 1
  • 1
user819774
  • 1,338
  • 1
  • 12
  • 39

0 Answers0