Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6019377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:24:47+00:00 2026-05-23T03:24:47+00:00

I have a mobile app using JQuery Mobile. Because of issues with blackberry I

  • 0

I have a mobile app using JQuery Mobile. Because of issues with blackberry I need to choose which JS files to load when the page is loaded. I do this on the html page like so:

<html>
<head>
<!-- Code -->
<script type = "text/javascript" >
//Check if phone is a blackberry
if (navigator.userAgent == 'BlackBerry') {
    //Load blackberry workaround
    var ourJSFile = document.createElement('script');
    ourJSFile.setAttribute("type", "text/javascript");
    ourJSFile.setAttribute("src", "DefaultBBWorkaround.js");
    //Load Newest JQuery
    var fileref = document.createElement('script');
    fileref.setAttribute("type", "text/javascript");
    fileref.setAttribute("src", "http://code.jquery.com/mobile/latest/jquery.mobile.min.js");
} else {
alert("Started");
    //Load default
    var ourJSFile = document.createElement('script');
    ourJSFile.setAttribute("type", "text/javascript");
    ourJSFile.setAttribute("src", "Default.js");
    //Load last stable version of JQuery
    var fileref = document.createElement('script');
    fileref.setAttribute("type", "text/javascript");
    fileref.setAttribute("src", "jquery.mobile-1.0a4.1.js");
    alert("Done");
}
</script>
</head>
<body>
<!-- Code -->
</body>
</html>

I hit both alert() calls, but the file is never loaded (I checked in firebug as well).
Is there something I am doing wrong here?

Also I want to do this for the css as well. I know to do so I would have to do this:

loadcss = document.createElement('link');
loadcss.setAttribute("rel", "stylesheet");
loadcss.setAttribute("type", "text/css");
loadcss.setAttribute("href", cssfile);
document.getElementsByTagName("head")[0].appendChild(loadcss);

Can I do that in the same <script> tag where I load the JS? or will that cause issues?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:24:48+00:00Added an answer on May 23, 2026 at 3:24 am

    You’ll need to append the generated script element(s) to the page in some fashion.

    var head = document.getElementsByTagName('head')[0];
    head.appendChild(ourJSFile);
    head.appendChild(fileref);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created app using jQuery Mobile and need to get a Dialog box
i have an app in Blackberry, I was Build in using Jquery Mobile, but
I have built an app using jQuery mobile. Apart of some compatibility issues across
I have a mobile app created using HTML/JS(jQuery)/CSS and I'm looking to include page
I have some strange scrolling problems with my PhoneGap (using jQuery Mobile) app: I'm
I've built a Jquery Mobile Android App using Phonegap which contains a form with
I have a mobile app I am creating with JQuery Mobile. When a blackberry
Say I have a mobile web app written using JQuery Mobile, this app retrieves
I have a jQuery Mobile web app which targets iOS and Android devices. A
I'm making an PhoneGap app using Jquery Mobile, but I have a little problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.