This is quite annoying, but I am building a jQuery mobile site. But if I have a page called about, I want this in a file called about.html. I did manage to get this to work, but all of a sudden I can't get a link to open a separate page. I have tried all sorts of things and now I get a white page.
Here is the test code I have been messing with:
Index:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<link rel="stylesheet" href="style.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="phonegap.0.9.4.min.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
// PhoneGap is ready
//
function onDeviceReady() {
// Empty
}
$('#about').live('pagecreate',function(event){ AboutTest(); });
$('#test2').live('pagecreate',function(event){ alert("loaded the page 2!"); });
function AboutTest(){
var element = document.getElementById('deviceProperties');
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device PhoneGap: ' + device.phonegap + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
'Device Version: ' + device.version + '<br />';
}
</script>
</head>
<body onload="onLoad()">
<div data-role="page" id="home">
<div data-role="header"><h2>Page 1</h2></div>
<div data-role="content">
<a href="about.html" data-url="about.html">testing</a>
</div><!-- /content -->
<div data-role="footer"><h4>Footer</h4></div>
</div><!-- /page -->
</body>
</html>
Here is my test page to link to, about.html:
<div data-role="page" id="about" data-title="about">
<div data-role="header"><h1>Page 2</h1></div>
<div data-role="content"><p id="deviceProperties">Loading device properties...</p></div>
<div data-role="footer"><h4>Footer</h4></div>
</div>
Now this all did work fine, the JavaScript code ran, etc. Then I have changed something. I am not sure what, but I've broken it and for the life of me I can't see it. The whole idea of all pages within one page seems so stupid and sensless.