IBM Worklight 6.0 - WL.Client.reloadApp() not working in Windows Phone 8

后端 未结 2 1554
栀梦
栀梦 2021-01-28 22:39

We are using Worklight 6.0.0 enterprise edition and currently building hybrid apps for android, BB, Windows Phone 8 and iOS.

We are currently getting the below error whe

相关标签:
2条回答
  • 2021-01-28 23:21

    Looking at the edited comments and question, the problem could be at the path used.

    Take a look at the multi-page sample project provided in the IBM Worklight Getting Started webpage. It contains special handling for WP8 which you may need to apply to your logout function as well.

    Building a multi-page application training module
    Multi-page sample project

    • See slides 8 and 9
    • Slide 8 talks about the implementation change below
    • Slide 9 talks about a change you must perform in jQuery Mobile's JS in order to make page navigation work.
    • Since you are using jQuery Mobile, take a look at this question and its answer: IBM Worklight v 5.0.6 - Can't navigate multipages on Windows Phone 7.5 environment

    Note how the path is handled specifically for Windows Phone 8.
    common\main.js:

    var path = "";
    
    function wlCommonInit(){
        // Special case for Windows Phone 8 only.
        if (WL.Client.getEnvironment() == WL.Environment.WINDOWS_PHONE_8) {
            path = "/www/default/";
        }
       ...
       ...
    }
    

    You need to now do one of two things:

    • account for the path for WP8
    • alter jQuery Mobile's JS if you use that
    0 讨论(0)
  • 2021-01-28 23:25

    Updated April 8th, 2014

    I have used the sample project you've provided in my previous answer.
    Here's an updated version: WindowsTestApp

    What I've done:

    1. Removed use of the path variable in wlCommonInit().

    2. Added the changeHash: false option to $.mobile.changePage().

      For example: $.mobile.changePage("Pages/MyAccount.html", { changeHash: false });

    3. In WindowTestApp.html

      Removed this line from the HEAD element:

      <script>window.$ = window.jQuery = WLJQ;</script>

    4. In js\jquery-1.10.2.js:

      Find

      xhr.open(s.type, s.url, s.async);

      Change to

      s.url = s.url.replace("x-wmapp0:///", "");
      xhr.open(s.type, s.url, s.async);


    Step 3 is correct use of changePage in case of using WL.Client.reloadApp().

    Step 4 seems to be a bug in jQuery/jQuery Mobile specific to handling to file location in Windows Phone.

    0 讨论(0)
提交回复
热议问题