Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(no-ie): add js snipped to check for internet explorer (#445) #519

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion Phonebook.Frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>

<body class="mat-typography">
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
Expand All @@ -47,5 +46,39 @@
} else {
top.location = self.location;
}
msieversion();

VanLampe marked this conversation as resolved.
Show resolved Hide resolved
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 ');
VanLampe marked this conversation as resolved.
Show resolved Hide resolved

if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
// stone age browser IE
var html =
'<div class="pb-no-ie"><p><strong>This application does not support Internet Explorer!</strong></p><p>To run the Phonebook, please use one of the following modern browsers:</p><ul>';
for (var key in browserList) {
html += '<li onclick="openURL(this)" value="' + browserList[key] + '"><strong>' + key + '</strong></li>';
DanielHabenicht marked this conversation as resolved.
Show resolved Hide resolved
}
html += '</ul></div>';
VanLampe marked this conversation as resolved.
Show resolved Hide resolved
document.getElementsByTagName('body')[0].innerHTML = html;
}
}
</script>
</html>
12 changes: 11 additions & 1 deletion Phonebook.Frontend/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,17 @@ app-root {
margin: auto 1%;
}
}

.pb-no-ie {
top: 38%;
left: 38%;
position: absolute;
Comment on lines +185 to +187
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
top: 38%;
left: 38%;
position: absolute;
margin: auto;
height: 200px;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damit ist es auch genau in der Mitte

}
.pb-no-ie li {
cursor: pointer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

das ist eigentlich überfüssig, <a> sind immer mit pointer belegt :)

&:hover {
VanLampe marked this conversation as resolved.
Show resolved Hide resolved
color: #9b9e9e;
}
}
//Media query classes
@include on-med-and-up {
.pb-hide-on-med-and-up {
Expand Down