Other not so elegant way of detecting touch screen devices

But at least it seems to work
This commit is contained in:
Christian Vogeley 2014-02-02 13:59:20 +01:00
parent 30aeb42bed
commit a2fa1a162d

View File

@ -91,8 +91,19 @@ function update_chats(chats) {
</script>
<script>
function isMobile() {
try{ document.createEvent("TouchEvent"); return true; }
catch(e){ return false; }
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
return true;
}
else {
return false;
}
}
$(function(){