I want to target an ipad device in javascript. I know it is possible to do this with user agent string parsing. But this is easy to fake.
I also read that it’s better to do a functionality test. like if(window.matchMedia) rather than if (userAgent.indexOf('ipad')) but still some functions exist in new browsers.
Is there anything that returns the word ipad in the browser ? thank you.
Yes, prior to it’s deprecation, navigator.platform could have done the job:
Refer to https://stackoverflow.com/a/9039885/1029952 for more solutions