03-23-2011, 09:32 PM
|
|
|
Confirmed User
Industry Role:
Join Date: Aug 2007
Location: Canada
Posts: 1,069
|
I'll try that
Quote:
Originally Posted by FlexxAeon
right here:
Code:
function doMobile(){
if(pageWidth() < 600){
mobile = true;
} else if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
mobile = true;
} else if((navigator.userAgent.match(/android/i))) {
mobile = true;
} else {
mobile = false;
}
it's only checking for ipod, iphone, and android. but opera is a third party browser so those terms probably wouldn't be in its user agent string. should be more like:
Code:
function doMobile(){
if(pageWidth() < 600){
mobile = true;
} else if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/android/i)) || (navigator.userAgent.match(/mobi/i)) || (navigator.userAgent.match(/mobile/i)) || (navigator.userAgent.match(/blackberry/i))) {
mobile = true;
} else {
mobile = false;
}
you can see where i added more user agent strings for it to check for. there's a shitload of them that you can be checking for. google around for "mobile user agents" and you'll see what i mean.
|
|
|
|