Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with FFx for Android ? #1

Open
vicnevicne opened this issue Nov 23, 2012 · 3 comments
Open

Incompatibility with FFx for Android ? #1

vicnevicne opened this issue Nov 23, 2012 · 3 comments

Comments

@vicnevicne
Copy link

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 :-(

@vernonk
Copy link
Owner

vernonk commented Jan 2, 2013

Thanks for pointing out the issue and sorry for the delay in getting on this. I've not seen your problem before.

Are you able to target the device in a debug situation? If so, are there any errors noted?

I'm working on getting an emulator running so that I can test this issue out.

@dpritula
Copy link

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.

Fix is correct and everything works as expected.

Thanks for awesome library and your hard work!

@vernonk
Copy link
Owner

vernonk commented Nov 18, 2013

Thanks @dpritula any chance you can put that into a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants