Skip to content

Commit

Permalink
Bugfix: Avoid (mostly harmless) error when not Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBizzle committed Nov 13, 2023
1 parent c0894a4 commit 7a3dbe4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions js/browser-compat-abort.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ const changeFirefoxConfig = `In order to use HubNet Web in Firefox, you will nee
Would you like to hide this message forever?`;

const regex = /^.*(Firefox)\/([0-9.]+)$/;
const [ , ff, version] = navigator.userAgent.match(regex);
const regex = /^.*(Firefox)\/([0-9.]+)$/;
const browserName = navigator.userAgent;

if (ff !== null) {
if (parseFloat(version) >= 111) {
const mode = localStorage.getItem("hideFFNotification") || "false";
if (mode === "false") {
const res = confirm(changeFirefoxConfig) || false;
localStorage.setItem("hideFFNotification", res);
if (regex.test(browserName)) {
const [ , ff, version] = browserName.match(regex);
if (ff !== null) {
if (parseFloat(version) >= 111) {
const mode = localStorage.getItem("hideFFNotification") || "false";
if (mode === "false") {
const res = confirm(changeFirefoxConfig) || false;
localStorage.setItem("hideFFNotification", res);
}
} else {
document.body.innerHTML = oldFirefoxBad;
}
} else {
document.body.innerHTML = oldFirefoxBad;
}
}

0 comments on commit 7a3dbe4

Please sign in to comment.