IBM Worklight v 5.0.6 - 无法在Windows Phone 7.5环境中导航多页 [英] IBM Worklight v 5.0.6 - Can't navigate multipages on Windows Phone 7.5 environment

查看:76
本文介绍了IBM Worklight v 5.0.6 - 无法在Windows Phone 7.5环境中导航多页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我在IBM Worklight v 5.0.6中遇到WP 7.5应用程序开发问题。
我使用了 ftp中的MultiPageApp项目: //public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v506/wl_gs_all_samples.zip 我的实验。

Hi I'm having trouble with WP 7.5 application development in IBM Worklight v 5.0.6. I used MultiPageApp Project from ftp://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v506/wl_gs_all_samples.zip for my experiment.

有我遇到的很多问题:

第一个问题

我建立了WP 7.5环境没有编辑代码的worklight。然后我在带有Emulator 7.1 256MB的MS Visual Studio 2012中运行它。问题只出现在MultiPageApplication.html的内容中。

I built WP 7.5 environment in worklight without editing the code. Then I run it in MS Visual Studio 2012 with Emulator 7.1 256MB. The problem is only the content of from MultiPageApplication.html appeared.

MultiPageApplication.html

<!DOCTYPE html>
<html>
    <head>
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" name="viewport">
        <title>MultiPageApplication</title>
        <link href="wlclient/css/wlclient.css" rel="stylesheet">
        <link href="images/favicon.png" rel="shortcut icon">
        <link href="images/apple-touch-icon.png" rel="apple-touch-icon">
        <link href="css/MultiPageApplication.css" rel="stylesheet">
        <script>

        // Define WL namespace.

        var WL = WL ? WL : {};



        /**

         * WLClient configuration variables.

         * Values are injected by the deployer that packs the gadget.

         */

        WL.StaticAppProps = {
   "APP_DISPLAY_NAME": "MultiPageApplication",
   "APP_SERVICES_URL": "http:\/\/169.254.17.188:8080\/apps\/services\/",
   "APP_VERSION": "1.0",
   "ENVIRONMENT": "windowsphone",
   "LOGIN_DISPLAY_TYPE": "embedded",
   "WORKLIGHT_ROOT_URL": "http:\/\/169.254.17.188:8080\/apps\/services\/api\/MultiPageApplication\/windowsphone\/"
};</script>
        <script src="wlclient/js/cordova.js"></script>
        <script src="common/js/wljq.js"></script>
        <script src="common/js/base.js"></script>
        <script src="wlclient/js/messages.js"></script>
        <script src="common/js/wlcommon.js"></script>
        <script src="wlclient/js/diagnosticDialog.js"></script>
        <script src="wlclient/js/deviceAuthentication.js"></script>
        <script src="wlclient/js/window.js"></script>
        <script src="wlclient/js/worklight.js"></script>
        <script src="wlclient/js/wlclient.js"></script>
        <script src="wlclient/js/wlfragments.js"></script>
        <script src="wlclient/js/encryptedcache.js"></script>
        <script src="wlclient/js/jsonstore/jsonstore.js"></script>
        <script src="wlclient/js/challengeHandlers/antiXSRFChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/authenticityChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/deviceAuthAutoProvisioningChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/deviceAuthNoProvisioningChallengeHandler.js"></script>
        <script src="wlclient/js/challengeHandlers/remoteDisableChallengeHandler.js"></script>
        <script src="wlclient/js/wlgap-wp7.js"></script><script>window.$ = window.jQuery = WLJQ;</script>

    </head>
    <body id="content" style="display: none">

        <div id="AppBody">
            <!-- This is static header, it will be shown always -->

            <div id="header">

                <h1>Multi page app</h1>

            </div>

            <!-- This is a placeholder for dynamic page content -->

            <div id="pagePort"></div>
        </div>

        <script src="js/initOptions.js"></script>
        <script src="js/MultiPageApplication.js"></script>
        <script src="js/messages.js"></script>

    </body>
</html>

MultiPageApplication.js

var pagesHistory = [];
var currentPage = {};

function wlCommonInit(){

    $("#pagePort").load("pages/MainPage.html", function(){
        currentPage.init();
    });
}

最后我通过更改jquery加载API的URL来解决这个问题(手动输入MS Visual Studio 2012)来自

At last I solve this by change the URL of jquery load API (manually in MS Visual Studio 2012) from

$("#pagePort").load("pages/MainPage.html",

$("#pagePort").load("default/pages/MainPage.html",

虽然代码正常工作,但另一个问题是

Although the code is working, another problem is


每次构建
的应用程序时,都会重新生成native / www中的文件,因此,对这些文件所做的任何更改都将丢失。

Files in native/www are regenerated every time the application is built, so any changes made to these files are lost.

我该怎么做才能正确生成URL?

what should I do to make the URL correctly generated?

第二个问题

当我想通过按下将页面从MainPage.html导航到Page1.html 加载Page1按钮,

When I want to navigate page from MainPage.html to Page1.html by pressing the "Load Page1" button,

Page1.html将无法加载,因为MultiPageApplication.js中的方法'init'不起作用。我从此处得到此错误MS Vis中的输出日志ual Studio 2012:

the Page1.html won't load because the method 'init' in MultiPageApplication.js doesn't work. And I got this error from the output log in MS Visual Studio 2012:

Log:"Error in error callback: File564653615 = TypeError: Object doesn't support property or method 'init'"

我尝试用jQueryMobile jquery-1.9.1.min更改Worklight中嵌入的jQuery .js和jquery.mobile-1.3.2.min.js,但同样的问题出现了。

I've tried changing the jQuery embedded in Worklight with jQueryMobile jquery-1.9.1.min.js and jquery.mobile-1.3.2.min.js, but the same problem occured.

所以,我该如何解决这个问题呢?是因为嵌入在Worklight中的jQuery在Visual Studio中不起作用吗?

so, how should I fix this problem? Is it because the jQuery embedded in Worklight doesn't work in Visual Studio?

谢谢

推荐答案

请尝试此处描述的解决方案: jQuery Mobile changePage()在Windows Phone中不起作用

Please try the solution described here: jQuery Mobile changePage() not working in Windows Phone

即:

open jquery.mobile-1.3.2.js 并重构以下内容:

-        var uri = url ? this.parseUrl( url ) : location,
-          hash = this.parseUrl( url || location.href ).hash;
+        var uri = this.parseUrl( url || location.href ),
+          hash = uri.hash;

和:

-        return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+        return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;

请注意,我只使用 changePage 方法检查了这个,但希望这个修复所有内容的文件位置,包括您遇到的内容。

Note that I only checked this with the changePage method, but hopefully this fixes the file location for everything, including what you are experiencing.

注意:务必将应用程序恢复到原始状态。

Note: Be sure to return the application to its original state.

这篇关于IBM Worklight v 5.0.6 - 无法在Windows Phone 7.5环境中导航多页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆