3 Replies Latest reply: Mar 22, 2013 12:37 PM by larry.phillips RSS

    ADF Mobile and Local HTML

      I'm using ADF Mobile with JDev I want to test the local HTML feature option so I created a feature and specified a local html file. I am using a Mac and targeting the iOS Simluator, plus an iPhone and an iPad. What I found is that the local file that I specify in the local HTML feature works correctly, but if I link it to a second html file the javascript in the second file never executes. Because they are just html files, I can run them in a browser and both pages work properly. But when I deploy them from ADF Mobile to the iOS Simulator, or to an iPhone or iPad, the first page executes correctly but the javascript on the 2nd page never fires. I stripped the javascript down to alert('Hello'); but it didn't make any difference. And besides, both pages work fine in the browser. Since the pages are linked to each other, i.e. I can navigate back and forth between the two by clicking a button on each page, I even modified the feature itself and specified the name of the second page in the feature definition. When I did that the javascript on the 2nd page (which was now the first page that I executed) ran correctly, but when I clicked the button to navigate back to the 1st page, the javascript on that page no longer executed. In other words the javascript only seems to execute on whichever page is named directly in the feature definition.

      Is this a known problem? Is there a workaround? Am I doing something wrong?
        • 1. Re: ADF Mobile and Local HTML
          I forgot to mention that I also tried specifying both files within the same feature in adfmf-feature.xml by specifying them as separate adfmf:content entries within the same adfmf:feature but I got the same result. The javascript executes properly on whichever file is listed on the first adfmf:content entry. The javascript on the second adfmf:content entry always fails to execute.
          • 2. Re: ADF Mobile and Local HTML
            Just to be sure, you have added your JS file(s) to each page separately? (In adfmf-feature.xml > Content / Include of every HTML page)
            • 3. Re: ADF Mobile and Local HTML
              Ok, after two days of fighting this I found a workaround. Maybe this is supposed to be the real solution. The local html pages that I am writing are using JQuery Mobile. JQuery Mobile supports what is known as a multi-page template. The Multi-Page Template allows you to combine all your mobile pages into a single html file. Of course your html file grows and grows and becomes harder to maintain if you do this. But I found that once I restructured the feature so that both of my mobile pages were defined in the same html file, I could navigate between those "pages" and all the javascript works fine on either one.

              Of course I would prefer a solution that lets me keep each mobile page in its own separate html file - what JQuery Mobile calls the single-page template. That's a lot easier to maintain and a less-error-prone approach. So I would still like to know if that is possible with the ADF Mobile "Local HTML" feature.