chore: fixes
This commit is contained in:
parent
84aaa7f3a3
commit
902d54a078
2 changed files with 40 additions and 0 deletions
39
javascript/legacy-check.js
Normal file
39
javascript/legacy-check.js
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// legacy-redirect.js
|
||||
|
||||
(function () {
|
||||
const legacyURL = "http://www.veltron.net/legacy.html";
|
||||
|
||||
const ua = navigator.userAgent || "";
|
||||
|
||||
// --- Target DSi / 3DS specifically ---
|
||||
const isDSiOr3DS =
|
||||
ua.includes("Nintendo DSi") ||
|
||||
ua.includes("Nintendo 3DS");
|
||||
|
||||
// --- Optional broader legacy browser checks ---
|
||||
const isOldIE =
|
||||
ua.includes("MSIE") || ua.includes("Trident/");
|
||||
|
||||
const isOperaMini =
|
||||
ua.includes("Opera Mini");
|
||||
|
||||
// Very old / limited mobile browsers fallback (optional)
|
||||
const isVeryOldMobile =
|
||||
/Android 2|Android 3|Symbian|webOS|BlackBerry/i.test(ua);
|
||||
|
||||
// Combine rules
|
||||
const isLegacyBrowser =
|
||||
isDSiOr3DS || isOldIE || isOperaMini || isVeryOldMobile;
|
||||
|
||||
// Prevent redirect loop
|
||||
const alreadyOnLegacy =
|
||||
window.location.href.startsWith(legacyURL);
|
||||
|
||||
// Optional override (useful for testing)
|
||||
const bypass =
|
||||
new URLSearchParams(window.location.search).has("noredirect");
|
||||
|
||||
if (isLegacyBrowser && !alreadyOnLegacy && !bypass) {
|
||||
window.location.href = legacyURL;
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue