I need to detect if the device viewing a website is an ipad (or other tablets).
Currently I am using this piece of code:
if ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {//do stuff}
It works fine when using Safari iOS but if I am accessing the site from an in-app browser such as the Twitter app, it doesn't get detected as iPad.
Is there a better method for device detection?
Thanks.