0

I am working on an app which supports 2 languages(English and Arabic) using JQuery mobile. Hence I need to to dynamically toggle(adding and removing) between jquery.mobile-1.4.2.min.js and rtl.jquery.mobile-1.4.0.js. I have tried

function loadjsfile(filename){   
    var fileref=document.createElement('script')   
    fileref.setAttribute("type","text/javascript")
    fileref.setAttribute("src", filename)  

    if (typeof fileref!="undefined")  
      document.getElementsByTagName("head")[0].appendChild(fileref)  
}

And similarly removing the js file. The app is navigating to the first screen(index.html). My assumption is that when either of the jquery.mobile-js is loaded, it initialises some values and when the js file is removed. Those variable values are lost hence navigating to first page.

Please help if any one has faced and overcome this issue. Also I am open for any suggestions. Thanks in advance.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • I'm not sure I see the issue. What problem do you have? – Nathan H Aug 04 '14 at 10:01
  • possible duplicate of [Can I use multiple versions of jQuery on the same page?](http://stackoverflow.com/questions/1566595/can-i-use-multiple-versions-of-jquery-on-the-same-page) – naXa stands with Ukraine Aug 04 '14 at 10:04
  • I am not talking about JQuery. I am talking about JQuery mobile js. – Sumanth Pai Aug 04 '14 at 13:58
  • My app supports both english and arabic and I need to switch(**remove one and add the other**) between these JS file's on click of a button. Basically rtl.jquery.mobile-1.4.0.js changes all the UI elemets (button, text etc..) from ltr to rtl. – Sumanth Pai Aug 05 '14 at 07:05
  • Once a library is cached, you need to reload/refresh page to load different libraries. – Omar Aug 05 '14 at 09:54
  • The switch(**remove one and add the other**) is working fine. But the page navigates to the first page(index.html). Is there anyway I can stop this navigation?? – Sumanth Pai Aug 06 '14 at 12:47

0 Answers0