1

I want to exclude the jQuery Mobile JS library from my header when a phone does not have "A grade" support as listed by jQuery Mobile (http://jquerymobile.com/gbs/). I find that on old Blackberry phones (that support JS) the jQM framework grinds these phones to a snails speed.

As an example these guys do a good job at serving up the jQuery Mobile library and associated styles depending on the mobile browser support: demo.livebookings.biz

How can I implement a similar server-side approach so that I can choose when to include JS files (e.g. jQM framework) and any CSS files as per the mobile browser support.

Thanks

2
  • Interesting. I can't seem to find any place where they state exactly how they graded it, although it's clear that with no ajax support, you cannot get an A. Commented Nov 17, 2011 at 20:53
  • Yes I have tried to look for the same thing. I think jQM checks browsers for web-kit. Commented Nov 17, 2011 at 20:58

3 Answers 3

1

The jQM functionality is Client Side, More on this here:

gradeA function that returns a boolean, default: a function returning the value of $.support.mediaquery
Any support conditions that must be met in order to proceed.

For Server Side you would need something like

I've used Mobile ESP before and have had great results with it. It's also easy to extend/customize

Sign up to request clarification or add additional context in comments.

3 Comments

@Phill Pafford, did you mean "The jQM functionality is Client Side" rather than "The jQM functionality is Server Side"?
@Jasper Nice catch, thanks. Sometimes what I think and what I type are a minute apart, LOL
Thanks @Phil, I'm using mdetect, I helps to server up JQM to the select few mobiles I want.
1

You have to do this by using the browsers user agent, but as there are so many its hard to do by your self (and keep it upto date), WURFL is a library that does all the hard work for you, works out the phone model and gives you the phones capabilities.

Using this you can find out whether the phone has certain features within the browsers and depending on what you call "A-grade" you can use JS libraries or not.

They have a pretty horrible website but the detailed library and PHP to read & cache it is all given to you.

6 Comments

I'd like to see some proof that you have to use the user agent, and not something else. I'd think that you SHOULDN'T use the useragent. . .
Thanks Jleagle, I already use WURFL on our main site to detect and redirect to specific urls for our mobile site. Is it possible to use WURFL to differentiate the "A grade" browsers listed here: jquerymobile.com/gbs from the rest?
@Levi what other way would there be to detect mobile browsers on the server?
I would chose a certain feature that only "A-grade" phones have, something like canvas support maybe? And make a decision using that. You have to chose programmatically, instead of just saying "is the phone in this list of good phones?"
@Martin You wouldn't check for agents at all, you check if certain things work properly. Automated tests for features. Honestly, I don't care what browser you are if you support my code, right?
|
1

You can do this client-side by feature detection using the jQuery $.support() method:

<script src="jquery-1.6.4.js"></script> <script> //check to see if media queries are supported (this is how the jQuery Mobile framework detects "grade A" browsers), $.support.mediaquery returns true or false if ($.support.mediaquery) { //if support is found then load the jQuery Mobile JS file $.getScript('jquery.mobile-1.0.js'); } </script> 

http://api.jquery.com/jquery.support

http://api.jquery.com/jquery.getscript

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.