Skip to content

Commit e26ec6c

Browse files
contrepointdi
authored andcommitted
2nd go: add browser warning for IE 10 (#3764)
* add browser warning for IE 10 * use double quotes for javascript strings * use correct element id name * prevent docready callbacks * fix linting errors * use an id that does not clash with class name * put unsupportedBrowser inline in doc-ready.js * actually call the function unsupportedBrowser, do not just pass it around * Simplification
1 parent f16d821 commit e26ec6c

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

warehouse/static/js/warehouse/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ import searchFilterToggle from "warehouse/utils/search-filter-toggle";
4444
import YouTubeIframeLoader from "youtube-iframe";
4545
import RepositoryInfo from "warehouse/utils/repository-info";
4646

47+
48+
// Show unsupported browser warning if necessary
49+
docReady(() => {
50+
if (navigator.appVersion.includes("MSIE 10")) {
51+
if (document.getElementById("unsupported-browser") !== null) return;
52+
53+
let warning_div = document.createElement("div");
54+
warning_div.innerHTML = "<div id='unsupported-browser' class='notification-bar notification-bar--danger'><span class='notification-bar__icon'><i class='fa fa-exclamation-triangle' aria-hidden='true'></i><span class='sr-only'>Warning:</span></span><span class='notification-bar__message'>You are using an unsupported browser, please upgrade to a newer version.</span></div>";
55+
56+
document.getElementById("sticky-notifications").appendChild(warning_div);
57+
}
58+
});
59+
4760
// Human-readable timestamps for project histories
4861
docReady(() => {
4962
timeAgo();

warehouse/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
Switch to mobile version
103103
</button>
104104

105-
<section class="stick-to-top js-stick-to-top">
105+
<section id="sticky-notifications" class="stick-to-top js-stick-to-top">
106106
<!-- Add browser warning. Will show for ie9 and below -->
107107
<!--[if IE]>
108108
<div class="notification-bar notification-bar--danger">

0 commit comments

Comments
 (0)