Categories
JavaScript Answers

How to detect iPad Mini in HTML5 and JavaScript?

Spread the love

To detect iPad Mini in HTML5 and JavaScript, we check the screen propeerties.

For instance, we write

const isIpadMini = screen.availWidth === 768 && screen.availHeight === 1004;
const isIpadMini2 = screen.availWidth === 748 && screen.availHeight === 1024;

to get the screen’s available width with the screen.availWidth property.

We get the screen’s available height with the screen.availHeight property.

We compare their widths and heights to check the iPad Mini version.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *