39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
// 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;
|
|
}
|
|
})();
|