From 7333459a471d2e8a16d25e1a1ab6aabbedc78d8b Mon Sep 17 00:00:00 2001 From: Parthasarathy Dharmalingam Date: Mon, 4 May 2020 14:23:37 +0530 Subject: [PATCH] IE Browser check added. --- Myrtille.Web/js/securden.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/Myrtille.Web/js/securden.js b/Myrtille.Web/js/securden.js index efef9c0..7e2b0b1 100644 --- a/Myrtille.Web/js/securden.js +++ b/Myrtille.Web/js/securden.js @@ -1,14 +1,33 @@ var disableUserClose = true; var isSessionConnected = false; +this.isIEBrowserExceptEdge = function () { + var ua = navigator.userAgent; + + // IE 10 or older + var msie = ua.indexOf('MSIE '); + if (msie > 0) { + return true; + } + + // IE 11 + var trident = ua.indexOf('Trident/'); + if (trident > 0) { + return true; + } + + return false; +}; + window.onbeforeunload = function (evt) { if (disableUserClose) { - return "Do you want to close tab?"; + if (!isIEBrowserExceptEdge() || isSessionConnected) { + return "Do you want to close tab?"; + } } } window.onunload = function (evt) { - alert(isSessionConnected); if (isSessionConnected) { doDisconnect(); }