How to detect iOS 13 on JavaScript?

javascript detect ios
detect ios version javascript
ios 13 wkwebview user agent
php detect ipad pro
javascript determine ios
javascript detect android
ios device detection
modernizr detect ios

I use this function to detect iOS

export function isiOS() {
  return navigator.userAgent.match(/ipad|iphone/i);
}

is there any way to make it detected iOS13+? thanks

Why do I need it? usually, iOS safari can't download files therefore to make image downloadable I should render it as

<img src={qrImage} alt="creating qr-key..." />

however on Android/PC and pretty much everywhere else it's possible to do it directly via

<a href={qrImage} download="filename.png">
    <img src={qrImage} alt="qr code" />
</a>

so user just press image and download it. Turned on on iOS13 now second option works while first one doesn't anymore.


I would like to advice you against detecting operating system or browser from user agent, since they are susceptible to change more than an API for that does, till a reliable stable standard API lands. I have no idea about when this second part will happen.

However, I can suggest to detect feature instead if in this case it is applicable to you.

You can check if the anchor html element supports download attribute:

"download" in document.createElement("a") // true in supporting browsers false otherwise

That way you can display the appropriate html markup depending on the output for each case. Something like that may help:

function doesAnchorSupportDownload() {
  return "download" in document.createElement("a")
}
// or in a more generalized way:
function doesSupport(element, attribute) {
  return attribute in document.createElement(element)
}

document.addEventListener("DOMContentLoaded", event => {
  if (doesAnchorSupportDownload()) {
    anchor.setAttribute("display", "inline"); // your anchor with download element. originally display was none. can also be set to another value other than none.
  } else {
    image.setAttribute("display", "inline"); // your alone image element.  originally display was none. can also be set to another value other than none.
  }
});

For example, I use following to detect if I am on an ar quick look supporting browser on iOS:

function doesSupportAnchorRelAR() {
  return document.createElement("a").relList.supports("ar");
}

You can also use techniques documented below: http://diveinto.html5doctor.com/detect.html#techniques

Does not detect iOS 13 beta · Issue #95 · hgoebl/mobile-detect.js , We are testing on the iOS 13 beta, and mobile detect is failing. This includes the demo. Here is the results of the demo: mobile()= ├─ phone()=  Detect a device is iOS or not using JavaScript. In order to detect a device whether it is iOS or not. We’re going to Navigator platform and Navigator userAgent property. Navigator userAgent property. This property returns the value of the user-agent header which is sent by the browser to the server. Returned value, have information about the name, version, and platform of browser.


You can detect iOS 13 on iPhone but in iPad OS 13 navigator.platform comes as MacIntel. So it is not possible to get iPad identified using below code, but it works perfectly on iPhone.

    if (/iP(hone|od|ad)/.test(navigator.platform)) {
        var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
        var version = [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
}

When user asks for mobile website using the browser navigator.platform returns as iPad and works perfectly.

Detect iPadOS 13, Starting in 2019, Apple iPads run a different OS called iPadOS. WURFL.js device detection distinguishes between Apple iPad and iPhone  Access the navigator.appVersion or navigator.userAgent property. Get the index of the OS using indexOf () method. If index is other than -1, then it is the OS, that we are looking for. Example 1: In this example, navigator.appVersion property is used to get the OS.


See this Link .

$(document).ready(function() {
    function iOSversion() {
        if (/iP(hone|od|ad)/.test(navigator.platform)) {
            var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
            return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
        }
    }

    ver = iOSversion();

    if (ver[0] >= 13) {
        alert('This is running iOS '+ver);
    }
});

Detect a device is iOS or not using JavaScript, In order to detect a device whether it is iOS or not. We're going to Navigator platform and Navigator userAgent property. Navigator userAgent property I know how to detect iOS 5: navigator.userAgent.match(/OS 5_\d like Mac OS X/i) but that won't work for iOS6 when it eventually comes around, or even iOS 5.0.1, only a 2 digit version. So this is what I have atm.


User Agent in Safari on iPadOS, Mozilla/5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 to the first user agent to allow us to detect if it is an ipad emulating safari desktop or if a user is browsing via an iPad with JavaScript and alters/restricts the content. (I just want to detect if the device is a target for an iOS app) – Vignesh Chinnaiyan May 13 at The most reliable way to detect Safari on iOS in JavaScript


Detect iOS Version with jQuery Javascript, Insecure Resource. You are linking to a resource using the non-secure http:// protocol, which may not work when the browser is using https:// like CodePen  I've found this code to detect if the device is in landscape orientation and in this case add a splash page saying "change orientation to see the site". It's working on iOS, android and windows phones. I think that this is very useful since it's quite elegant and avoid to set a landscape view for the mobile site. The code is working very well.


Detect IOS Device and Display Button only if on IOS, Is it possible to run a script to detect IOS and only show in that scenario? I had initially tried javascript, ios, browser, browser-feature-detection. The task is to detect a device, whether the device is Android Phone or not using JavaScript. Approach 1: Use navigator.userAgent property to get the value of the user-agent header sent by the browser to the server.