我有一个Angular6应用程序,我们仅支持Chrome浏览器,但如果用户尝试在IE中导航到该应用程序,则要求显示页面/消息,指出不支持IE并建议使用Chrome浏览器打开或下载Chrome。
我需要使用Polyfill让该应用程序能够在IE上运行并显示此消息,还是可以使用某种浏览器检测方法仅显示此弹出窗口?
我知道可以在TS中进行浏览器检测,但这意味着我需要使用IE Polyfill,以便即使显示页面也能加载该应用程序。
有什么想法?谢谢!
我需要使用Polyfill让该应用程序能够在IE上运行并显示此消息,还是可以使用某种浏览器检测方法仅显示此弹出窗口?
我知道可以在TS中进行浏览器检测,但这意味着我需要使用IE Polyfill,以便即使显示页面也能加载该应用程序。
// 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'] || safari.pushNotification);
// Internet Explorer 6-11
var isIE = /*@cc_on!@*/false || !!document.documentMode;
// Edge 20+
var isEdge = !isIE && !!window.StyleMedia;
// Chrome 1+
var isChrome = !!window.chrome && !!window.chrome.webstore;
// 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 += 'isBlink: ' + isBlink + '<br>';
document.body.innerHTML = output;
有什么想法?谢谢!