simon
simon

Reputation: 6117

Can I reasonably assume mobile browsers with JavaScript also support jQuery?

I realise that this question may be almost impossible to answer definitively, but:

Is it reasonable to assume that mobile browser with JavaScript can also cope with jQuery? We're talking relatively basic jQuery such as click events and Ajax.

I'm writing a mobile HTML app. It involves slippy maps so anyone who wants to use it has to have JavaScript.

I'd much prefer to use jQuery for the rest of the coding if possible, but can I reasonably say to the client "any phone with JavaScript should support basic jQuery"?

I know about jQuery mobile, but I'm specifically talking about phones that aren't advanced enough to handle jQuery mobile, but do have JavaScript.

Thanks!

Upvotes: 4

Views: 684

Answers (8)

Groovetrain
Groovetrain

Reputation: 3325

In short: yes.

HOWEVER, if you're only doing Ajax and other little things, you'll see a significant speed gain just using vanilla JS. But I do realize this can be somewhat of a pain. There are lighter-weight packages out there, like xui.

Honestly, I'd consider programming separate sites for mobile Safari (iOS and Android), and other lower-powered devices that don't run WebKit.

To iterate again: jQuery.mobile is NOT a replacement for jQuery, but rather framework that builds on jQuery, much like jQuery-ui does. This would be an even larger footprint and bootstrap time.

Upvotes: 1

capdragon
capdragon

Reputation: 14899

It should run okay on most... don't expect much from explorer pocket.

Although jQuery functions across these browsers, IRL many of the cool effects that jQuery makes simple won't be seen on a mobile browser, because the interface is so different. There is (almost) no concept of mousedown, mouseup, or hover; click and focus behave differently, screensize is different vs effective window size, animations are slow, etc. The challenge in mobile browsers is mostly in the interface design. The main advantage IMO is AJAX-loaded content, for speed and low data/bandwidth usage.

Upvotes: 1

eykanal
eykanal

Reputation: 27017

Check out jQuery mobile, as well as this very informative slideshare which describes the scope and difficulty of the problem you're facing.

Upvotes: 0

neeebzz
neeebzz

Reputation: 11538

Yes but you will better off using jQuery Mobile in case you are developing for mobile devices. It's optimized for them.

Upvotes: 0

Peter Olson
Peter Olson

Reputation: 142921

The answer is simple: yes.

JQuery, and especially its most basic features, is designed to be cross browser. If the mobile browser has reasonable javascript support, JQuery should not be an issue.

For fallbacks on features you aren't sure whether or not are supported, you can use jquery.Support or Modernizr

Upvotes: 1

Alex Netkachov
Alex Netkachov

Reputation: 13522

You can check http://jquerymobile.com/ - maybe it is what you should use on your pages instead of "regular" jquery.

Upvotes: 0

riwalk
riwalk

Reputation: 14223

Yes.

jQuery is not a language. It is a library written in JavaScript, and therefore if you can run JavaScript reasonably well, you should be able to run jQuery without any problems.

With that being said, nothing compares to actual testing. Periodically check that your code works across multiple platforms (not only on different phones, but different web browsers as well).

Upvotes: 5

Jan
Jan

Reputation: 8141

javascript is javascript. You can always use jQuery.support to detect features. You should test on the browsers you want to support anyway.

Upvotes: 1

Related Questions