Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check browser

// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';

// Safari 3.0+ "[object HTMLElementConstructor]" 
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && window['safari'].pushNotification));

// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;

// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;

// Chrome 1 - 79
var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);

// Edge (based on chromium) detection
var isEdgeChromium = isChrome && (navigator.userAgent.indexOf("Edg") != -1);

// Blink engine detection
var isBlink = (isChrome || isOpera) && !!window.CSS;


var output = 'Detecting browsers by ducktyping:<hr>';
output += 'isFirefox: ' + isFirefox + '<br>';
output += 'isChrome: ' + isChrome + '<br>';
output += 'isSafari: ' + isSafari + '<br>';
output += 'isOpera: ' + isOpera + '<br>';
output += 'isIE: ' + isIE + '<br>';
output += 'isEdge: ' + isEdge + '<br>';
output += 'isEdgeChromium: ' + isEdgeChromium + '<br>';
output += 'isBlink: ' + isBlink + '<br>';
document.body.innerHTML = output;
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: perform a function on each element of array javascript 
Javascript :: framer motion reactjs 
Javascript :: Appending the option element using jquery each function 
Javascript :: angular Failed to make request to https://www.gstatic.com/firebasejs/releases.json 
Javascript :: convert string to lowercase javascript 
Javascript :: get filenem js 
Javascript :: get text selected 
Javascript :: react 18 rendering twice 
Javascript :: remove array item with index 
Javascript :: javascript get second last element of array 
Javascript :: react router dom v6 private route 
Javascript :: get before 6 month date javascript node js 
Javascript :: javascript parsefloat 
Javascript :: new line with javascript write 
Javascript :: javascript slice method 
Javascript :: js stringify 
Javascript :: google geocode nodejs 
Javascript :: types for parameter destructuring 
Javascript :: react-router-dom routes 
Javascript :: range in javascript 
Javascript :: for loop in javascript 
Javascript :: returned value by findOneAndUpdate 
Javascript :: jquery if is visible 
Javascript :: Laravel JSON Where Query 
Javascript :: expo font 
Javascript :: react navigation hide header 
Javascript :: how to call a function in react with arguments onclick 
Javascript :: javaScript Option to deactivate all bs.tooltip on document 
Javascript :: vs code shortcut for switching to terminal to editor 
Javascript :: how to get the last two characters of a string in javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =