简体   繁体   中英

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!

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).

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

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

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.

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.

您可以查看http://jquerymobile.com/ - 也许这是您应该在页面上使用的而不是“常规”jquery。

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

查看jQuery mobile ,以及这个信息丰富的slidehare ,它描述了您遇到的问题的范围和难度。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM