You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open https://apps.ankiweb.net/ on Android (any browser)
Scroll down to Download Anki
Should appear as iOS/Android, Redirects to Linux instead
Tested with Brave, Samsung, Chrome browsers
Current Script
var os = navigator.platform;
var ua = navigator.userAgent;
if (os == "Win32") {
$("a[href=#windows]").tab("show");
} else if (os == "MacIntel") {
$("a[href=#mac]").tab("show");
} else if (!!os.match(/Linux/i)) {
$("a[href=#linux]").tab("show");
} else {
if (!!(ua.match(/(iPad|iPhone|iPod)/i) || !!ua.match(/Android/i))) {
$("a[href=#ios]").tab("show");
} else {
$("#unknown").show();
}
}
Ideas
(!!os.match(/Linux/i)) could be automatically assigning every Android device as Linux before !!ua.match(/Android/i)))
Five Methods to Detect Mobile Browsers in JavaScript
if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) {
// Current device is a mobile device
}
// Alternate approach
if (
navigator.userAgent.match(/Mobi/i) ||
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/iPhone/i)
) {
// Current device is a mobile device
}
Navigator: userAgent property - Web APIs | MDN
Browser detection using the user agent - HTTP | MDN
Detecting Mobile vs. Desktop Browsers in JavaScript | by Stephanie Zhan | Geek Culture | Medium
Detecting Mobile Browser - SoByte
Check mobile device using JavaScript | PixelsTech
Originally reported on https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110
The text was updated successfully, but these errors were encountered: