This is pretty annoying, but I'm building a jQuery mobile site. But if I have a page called about , I want this in a file called about.html . I managed to get this to work, but suddenly I canβt get the link to open a separate page. I tried all kinds of things and now I get a white page.
Here is the test code I was 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> <div data-role="footer"><h4>Footer</h4></div> </div> </body> </html>
Here is my test page for the link, 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 all this works fine, JavaScript code is running, etc. Then I changed something. Iβm not sure, but I broke it and for life I do not see me. The whole idea of ββall the pages in one page seems so stupid and pointless.
source share