You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code seems to fulfill my needs, but testing it on Firefox for Android, the code breaks as soon as I access the MODETECT.device.xxx properties.
e.g. the following page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="modetect.js"></script>
<script type="text/javascript">
<!--
alert("iPhone: " + (MODETECT.device.iphone?"yes":"no"));
// -->
</script>
</head>
<body>
Hello.
</body>
</html>
I never get any alert.
This is on Firefox 16 on HTC Desire.
Successfully tried on
Chrome/FF/IE on Win7 64
Safari on iPod 3rd gen
Safari/Chrome on iPad 3
Android browser/Opera on HTC Desire
It may be a Firefox bug but I can't use that script if it's not reliable on all tested platforms :-(
The text was updated successfully, but these errors were encountered:
This happens because of FF on Android has some custom UserAgent string and regular expression exec returns null instead of array. My temporary fix is:
var fullVersion = pattern.exec(window.navigator.userAgent);
if (fullVersion === null) {
return false;
}
var majorVersion = parseInt(fullVersion[1], 10);
in testVersion function.
I use FF on desktop with UserAgent "5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0" founded somewhere in Internet to reproduce this situation.
This code seems to fulfill my needs, but testing it on Firefox for Android, the code breaks as soon as I access the MODETECT.device.xxx properties.
e.g. the following page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="modetect.js"></script>
<script type="text/javascript">
<!--
alert("iPhone: " + (MODETECT.device.iphone?"yes":"no"));
// -->
</script>
</head>
<body>
Hello.
</body>
</html>
I never get any alert.
This is on Firefox 16 on HTC Desire.
Successfully tried on
It may be a Firefox bug but I can't use that script if it's not reliable on all tested platforms :-(
The text was updated successfully, but these errors were encountered: