2

I'm developing a web-based JQuery Mobile application with ASP.NET MVC 4, and I want to make it available as a smartphone application via PhoneGap.

But, JQuery Mobile and other plugins are heavy and I shouldn't download them every time user loads the page.

I want to load CSS styles, JQuery Mobile and other libraries locally.

My idea is: putting an iframe in local html file of app, load remote web pages without scripts and styles, and then, inject CSS styles and Javascript libraries into that iframe.

What do you think? Do you have any better idea? if true, What is your idea? And if false, How to inject JQuery, JQuery mobile and other plugins into that iframe???

Mahdi Ghiasi
  • 14,873
  • 19
  • 71
  • 119
  • check this question for mobile css injecting: http://stackoverflow.com/questions/6459692/load-mobile-css-if-user-is-on-android – Barlas Apaydin Jul 18 '12 at 10:57
  • @barlasapaydin I think you didn't understand my question. My question is **not** about loading different css and js files for different platforms. My question is about loading css and js files locally. – Mahdi Ghiasi Jul 18 '12 at 10:59
  • As long as I remember, getting the .load event of iframe was a challenge for me once. I would suggest that at the bottom of your html, write a script with vanilla js to include css and js files. Remember if you are adding multiple js files, you cannot just create DOM script tags and append them to head in sequence. You will have to load a script and wait for its load event to add another script. Something like http://aamirafridi.com/jquery/simple-javascript-files-loader-for-embeddable-javascript-application – Aamir Afridi Nov 20 '13 at 14:56

0 Answers0