# \[AnkiWeb\] apps.ankiweb does not detect Android, redirects to Linux instead

**URL:** <https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110>\
**Category:** Syncing & AnkiWeb\
**Created:** [December 12, 2024, 3:29pm UTC](https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110 "2024-12-12T15:29:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![NameLessGO](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/namelessgo/32/34298_2.png) [@NameLessGO](https://forums.ankiweb.net/u/NameLessGO)\
**Post date:** [December 12, 2024, 3:29pm UTC](https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110/1 "2024-12-12T15:29:14Z")

</div>

## Steps to replicate

1. Open [https://apps.ankiweb.net/](https://apps.ankiweb.net/) on Android (any browser)
2. Scroll down to Download Anki
3. Should appear as iOS/Android, Redirects to Linux instead

Tested with Brave, Samsung, Chrome browsers

## Current Script

```auto
  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](https://freedium.cfd/https://aifou.medium.com/five-methods-to-detect-mobile-browsers-in-javascript-c7f80ae02da6)

```auto
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
}

```

* * *

⭐[https://dev.to/timhuang/a-simple-way-to-detect-if-browser-is-on-a-mobile-device-with-javascript-44j3](https://dev.to/timhuang/a-simple-way-to-detect-if-browser-is-on-a-mobile-device-with-javascript-44j3)

```auto
const isMobile = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);

```

* * *

## Links

- [Navigator: userAgent property - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent)
- [Browser detection using the user agent string (UA sniffing) - HTTP | MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent)
- [https://medium.com/geekculture/detecting-mobile-vs-desktop-browsers-in-javascript-ad46e8d23ce5](https://medium.com/geekculture/detecting-mobile-vs-desktop-browsers-in-javascript-ad46e8d23ce5)
- [Detecting Mobile Browser - SoByte](https://www.sobyte.net/post/2021-09/detecting-mobile-browser/)
- [Check mobile device using JavaScript | PixelsTech](https://www.pixelstech.net/article/1633153808-Check-mobile-device-using-JavaScript)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [December 14, 2024, 12:30pm UTC](https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110/2 "2024-12-14T12:30:06Z")

</div>

Logged on [[AnkiWeb] apps.ankiweb does not detect Android, redirects to Linux instead · Issue #3636 · ankitects/anki · GitHub](https://github.com/ankitects/anki/issues/3636)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [January 13, 2025, 12:31pm UTC](https://forums.ankiweb.net/t/ankiweb-apps-ankiweb-does-not-detect-android-redirects-to-linux-instead/53110/3 "2025-01-13T12:31:05Z")

</div>

Closed on January 13, 2025, 12:31pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
