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.
There are many problems I had :
First Problem
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();
});
}
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",
to
$("#pagePort").load("default/pages/MainPage.html",
Although the code is working, another problem is
Files in native/www are regenerated every time the application is built, so any changes made to these files are lost.
what should I do to make the URL correctly generated?
Second Problem
When I want to navigate page from MainPage.html to Page1.html by pressing the "Load Page1" button,
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'"
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.
so, how should I fix this problem? Is it because the jQuery embedded in Worklight doesn't work in Visual Studio?
Thanks