Search code examples
jquery-mobilehtml5boilerplate

jQuery Mobile and HTML5 Boilerplate


Does anybody know of a way to make jQuery Mobile load only on pages with certain screen resolutions? I don't want jQuery Mobile to load if somebody is viewing the page from a desktop/laptop browser because I want to use HTML5 Boilerplate.

For example, if somebody visits my page from their iPhone, I want jQuery Mobile to format the site with the theme I have created, but if they view it from their desktop, I don't want jQuery Mobile to add all the extra tags and stuff.

Thanks


Solution

  • <script type="text/javascript">
    <!--
    
    var fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", "js/jqueryMobile.js")   
    
    if (screen.width <= 480) {
    document.getElementsByTagName("head")[0].appendChild(fileref);
    }
    //-->
    </script>