From 5dc9f7c4ab2447c671706652f3302236fdd2d717 Mon Sep 17 00:00:00 2001 From: Frank Lambrette Date: Tue, 10 Mar 2020 12:24:35 +0100 Subject: [PATCH 1/8] fix(no-ie): add js snipped to check for internet explorer (#445) check for ie links to open pb in other common browsers --- Phonebook.Frontend/src/index.html | 36 +++++++++++++++++++++++++++++- Phonebook.Frontend/src/no-ie.js | 12 ++++++++++ Phonebook.Frontend/src/styles.scss | 12 +++++++++- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Phonebook.Frontend/src/no-ie.js diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index cbfaf1ad5..e8196c6b0 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -2,6 +2,7 @@ + Phonebook @@ -28,7 +29,6 @@ - @@ -47,5 +47,39 @@ } else { top.location = self.location; } + msieversion(); + + function openURL(e) { + browser = e.getAttribute('value'); + if (browser == 'microsoft-edge') { + //edge can not be opened via shell + window.open((browser = e.getAttribute('value') + ':' + window.location.href)); + } else { + new ActiveXObject('WScript.Shell').run(browser + ' ' + window.location.href); + } + } + + function msieversion() { + var browserList = { + //list of browser-links where app can be openend in: key=browser name, value=shell-command to open browser + 'Microsoft Edge': 'microsoft-edge', + 'Google Chrome': 'chrome', + 'Mozilla Firefox': 'firefox', + Opera: 'opera' + }; + var ua = window.navigator.userAgent; + var msie = ua.indexOf('MSIE '); + + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { + // stone age browser IE + var html = + '

This application does not support Internet Explorer!

To run the Phonebook, please use one of the following modern browsers:

'; + document.getElementsByTagName('body')[0].innerHTML = html; + } + } diff --git a/Phonebook.Frontend/src/no-ie.js b/Phonebook.Frontend/src/no-ie.js new file mode 100644 index 000000000..ef4ffed6f --- /dev/null +++ b/Phonebook.Frontend/src/no-ie.js @@ -0,0 +1,12 @@ +function msieversion() { + var ua = window.navigator.userAgent; + var msie = ua.indexOf('MSIE '); + + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { + // stone age browser IE + console.log('not supported'); + var html = + '

Please notice: This app does not support Internet Explorer!

To run the Phonebook, please use one of the following modern browsers:

'; + document.getElementsByTagName('body')[0].innerHTML = html; + } +} diff --git a/Phonebook.Frontend/src/styles.scss b/Phonebook.Frontend/src/styles.scss index 309abc7a2..60a4b0049 100644 --- a/Phonebook.Frontend/src/styles.scss +++ b/Phonebook.Frontend/src/styles.scss @@ -181,7 +181,17 @@ app-root { margin: auto 1%; } } - +.pb-no-ie { + top: 38%; + left: 38%; + position: absolute; +} +.pb-no-ie li { + cursor: pointer; + &:hover { + color: #9b9e9e; + } +} //Media query classes @include on-med-and-up { .pb-hide-on-med-and-up { From 9a25012f4cd0b293a04fd76c9f90a536653ccbe6 Mon Sep 17 00:00:00 2001 From: Frank Lambrette Date: Tue, 10 Mar 2020 12:34:23 +0100 Subject: [PATCH 2/8] fix(no-ie): remove unnecessary script from index (#519) --- Phonebook.Frontend/src/index.html | 1 - Phonebook.Frontend/src/no-ie.js | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 Phonebook.Frontend/src/no-ie.js diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index e8196c6b0..b7cc9ea2f 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -2,7 +2,6 @@ - Phonebook diff --git a/Phonebook.Frontend/src/no-ie.js b/Phonebook.Frontend/src/no-ie.js deleted file mode 100644 index ef4ffed6f..000000000 --- a/Phonebook.Frontend/src/no-ie.js +++ /dev/null @@ -1,12 +0,0 @@ -function msieversion() { - var ua = window.navigator.userAgent; - var msie = ua.indexOf('MSIE '); - - if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { - // stone age browser IE - console.log('not supported'); - var html = - '

Please notice: This app does not support Internet Explorer!

To run the Phonebook, please use one of the following modern browsers:

'; - document.getElementsByTagName('body')[0].innerHTML = html; - } -} From f12f03a582538dcb4b3ea74cebda5696ecc0b56a Mon Sep 17 00:00:00 2001 From: FrankLambrette <55480780+FrankLambrette@users.noreply.github.com> Date: Tue, 10 Mar 2020 13:41:06 +0100 Subject: [PATCH 3/8] fix(no-ie): resolve comment Co-Authored-By: DanielHabenicht --- Phonebook.Frontend/src/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index b7cc9ea2f..071c3205e 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -76,7 +76,8 @@ for (var key in browserList) { html += '
  • ' + key + '
  • '; } - html += ''; + html += '

    If this was detected by mistake consider opening an issue.

    '; + document.getElementsByTagName('body')[0].innerHTML = html; } } From 6227bd73d7b70ccf0d4a42ab5052f7c7eb343196 Mon Sep 17 00:00:00 2001 From: Frank Lambrette Date: Wed, 11 Mar 2020 09:43:49 +0100 Subject: [PATCH 4/8] fix(no-ie): remove AxtiveX elements add download links for modern browsers --- Phonebook.Frontend/src/index.html | 28 ++++++++++------------------ Phonebook.Frontend/src/styles.scss | 3 ++- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index 071c3205e..ac4870929 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -48,23 +48,12 @@ } msieversion(); - function openURL(e) { - browser = e.getAttribute('value'); - if (browser == 'microsoft-edge') { - //edge can not be opened via shell - window.open((browser = e.getAttribute('value') + ':' + window.location.href)); - } else { - new ActiveXObject('WScript.Shell').run(browser + ' ' + window.location.href); - } - } - function msieversion() { var browserList = { - //list of browser-links where app can be openend in: key=browser name, value=shell-command to open browser - 'Microsoft Edge': 'microsoft-edge', - 'Google Chrome': 'chrome', - 'Mozilla Firefox': 'firefox', - Opera: 'opera' + //list of browser-links where app can be openend in: key=browser name, value=link for browser download + 'Google Chrome': 'https://www.google.de/chrome/', + 'Mozilla Firefox': 'https://www.mozilla.org', + Opera: 'https://www.opera.com' }; var ua = window.navigator.userAgent; var msie = ua.indexOf('MSIE '); @@ -72,11 +61,14 @@ if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // stone age browser IE var html = - '

    This application does not support Internet Explorer!

    To run the Phonebook, please use one of the following modern browsers:

      '; + '

      This application does not support Internet Explorer!

      To run the Phonebook, please open it in Microsoft Edge or use one of the following modern browsers:

        '; for (var key in browserList) { - html += '
      • ' + key + '
      • '; + html += '
      • ' + key + '
      • '; } - html += '

      If this was detected by mistake consider opening an issue.

      '; + html += + '

    If this was detected by mistake consider opening an issue.

    '; document.getElementsByTagName('body')[0].innerHTML = html; } diff --git a/Phonebook.Frontend/src/styles.scss b/Phonebook.Frontend/src/styles.scss index 60a4b0049..6d205b589 100644 --- a/Phonebook.Frontend/src/styles.scss +++ b/Phonebook.Frontend/src/styles.scss @@ -186,8 +186,9 @@ app-root { left: 38%; position: absolute; } -.pb-no-ie li { +.pb-no-ie a { cursor: pointer; + text-decoration: none; &:hover { color: #9b9e9e; } From c002afb76eceeb87096cae4233a4768acc20aef9 Mon Sep 17 00:00:00 2001 From: FrankLambrette <55480780+FrankLambrette@users.noreply.github.com> Date: Wed, 11 Mar 2020 13:38:47 +0100 Subject: [PATCH 5/8] fix(no-ie): wrap ie-detection in one line Co-Authored-By: DanielHabenicht --- Phonebook.Frontend/src/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index ac4870929..10bfba0c6 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -55,8 +55,8 @@ 'Mozilla Firefox': 'https://www.mozilla.org', Opera: 'https://www.opera.com' }; - var ua = window.navigator.userAgent; - var msie = ua.indexOf('MSIE '); + var msie = window.navigator.userAgent.indexOf('MSIE '); + if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) { // stone age browser IE From 4e65df1978039d9a284ae34c8250c7ffddf21bcf Mon Sep 17 00:00:00 2001 From: FrankLambrette <55480780+FrankLambrette@users.noreply.github.com> Date: Wed, 11 Mar 2020 13:39:57 +0100 Subject: [PATCH 6/8] fix(no-ie):resolve comment Co-Authored-By: DanielHabenicht --- Phonebook.Frontend/src/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Phonebook.Frontend/src/index.html b/Phonebook.Frontend/src/index.html index 10bfba0c6..83c59ce64 100644 --- a/Phonebook.Frontend/src/index.html +++ b/Phonebook.Frontend/src/index.html @@ -48,6 +48,9 @@ } msieversion(); + + +