Today I learned that my mobile site does not work in IE because IE does not support AJAX calls through jQuery Mobile. I went on Internet searching for answer. This time I was not lucky. Internet community did not bring any good news. It looks like many developers have the same problem. I found a code snippet which did not work at all. It should be added after jquery is loaded and before jQuery Mobile is added. Here it is :
<script type="text/javascript">
//run this script after jQuery loads, but before jQuery Mobile loads
//customize jQuery Mobile to let IE7+ in (Mobile IE)
$(document).bind("mobileinit", function(){
$.extend( $.mobile , {
//extend gradeA qualifier to include IE7+
gradeA: function(){
//IE version check by James Padolsey, modified by jdalton - from http://gist.github.com/527683
var ie = (function() {
var v = 3, div = document.createElement('div'), a = div.all || [];
while (div.innerHTML = '', a[0]);
return v > 4 ? v : !v;
}());
//must either support media queries or be IE7+
return $.support.mediaquery || (ie && ie >= 7);
}
});
});
</script>
My coworkers and I agree to leave mobile version as it is. It looks like it works for most mobile devices, bit it does not work only for desktop IE. I think, jQuery Mobile really meant to be for MOBILE!
No comments:
Post a Comment