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

0.4.1 - When included in a iPad WebApp stops working #185

Closed
folletto opened this issue Jul 22, 2010 · 11 comments
Closed

0.4.1 - When included in a iPad WebApp stops working #185

folletto opened this issue Jul 22, 2010 · 11 comments

Comments

@folletto
Copy link

RaphaelJS 0.4.1: when you try using it within an iPad WebApp stops working, while in Safari it works perfectly.

Reproduction:

  1. take this demo: http://g.raphaeljs.com/piechart.html
  2. add the header to make of it a webapp:
  3. load the page in the iPad
  4. add to the home screen
  5. open
@djw
Copy link

djw commented Jul 23, 2010

Works for me using the header

    <meta name="apple-mobile-web-app-capable" content="yes">

If you're accessing over 3G have you tried over wi-fi? Your problem could be related to this: http://stackoverflow.com/questions/3282373/web-site-exhibits-javascript-error-on-ipad-iphone-under-3g-but-not-under-wifi

@folletto
Copy link
Author

Yes that was the line stripped out from the report. :P

However unfortunately I was developing on WiFi - I don't have an iPad 3G - so no luck.

Do you have any hint on how I could track the problem, since in WebApp mode it's a bit harder to guess what's happening?

From my early test, I can just say that the Raphael() function was "undefined", like it never loaded. :/

@djw
Copy link

djw commented Jul 23, 2010

Are you sourcing Raphael directly from http://raphaeljs.com/raphael.js? For me that never works — I expect Dmitry prevents it to save on bandwidth bills. :-)

@folletto
Copy link
Author

No, it was all self-hosted (OSX, Apache, PHP). That might be one of the places to look. I'll try this evening doing a few tests: even if this isn't going to be a bug, it might be useful nontheless. :)

@folletto
Copy link
Author

Nothing, keeps happening. Same sequence of steps as above, hosted on my Mac's Apache and same result on one of my websites.

Could you try with this one, adding to your iPad home as a webapp?
http://digitalhymn.com/warehouse/raphaeljsdemo/

@djw
Copy link

djw commented Jul 25, 2010

Ok, got it.

In WebApp mode, Safari changes its user agent from:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B405 Safari/531.21.10

to:

Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405

In v1.4.6 Dmitry changed the way that Raphaël extracts the version number from the browser's user agent to unconditionally assume that the "Version/x.y.z" part is present. Since it's not, the regex match returns null, and so requesting the first element gives a TypeError.

@folletto
Copy link
Author

Interesting and... great! :)

@victorvanrijn
Copy link

djw: Thank you very much for your reply, I came across the same problem when including raphael in a webView using Appcelerator's Titanium mobile to build an iphone app. The error happens in the regex on line 2566 of the 1.4.7 version of raphael.js where it tests for the Version in the navigator.userAgent. Changing the order of the 2 tests in the second part of the conditional or adding a test like: navigator.userAgent.match(/AppleWebKit/) before the one which fails will resolve this issue. (I hope this will be addressed by the author)

@IlyaSemenov
Copy link

I just reported #203 which is apparently the same problem.

@shaungehring
Copy link

Just to reiterate if you change line 2566 to:

    if ((navigator.vendor == "Apple Computer, Inc.") && (win.navigator.platform.slice(0, 2) == "iP" || navigator.userAgent.match(/Version\/(.*?)\s/)[1] < 4)) {

then everything will work on the iPad in web-app mode.

@DmitryBaranovskiy
Copy link
Owner

fixed

This issue was closed.
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

6 participants