I have a page that has a link to an internal page,please find the code below.
<body>
<div id="serviceDetailsPage" data-role="page">
<div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme="e">
</div>
<div data-role="content">
<a class="loadAudio" data-role="button" data-mini="true" data-inline="true" href="#testPage">test</a>
</div>
<div data-role="footer" class="footerLinks" data-position="fixed">
</div>
</div>
<div id="testPage" data-role="page">
<div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme="e">
</div>
<div data-role="content">
testPage
</div>
<div data-role="footer" class="footerLinks" data-position="fixed">
</div>
</div>
<script>
$('#testPage').live('pagecreate',function(){
console.log(window.location.hash);//returns an empty string
console.log(window.location.href);//returns old URL
});
</script>
</body>
When the page loads the URL is
../MyApp/index.html
after clicking the link the URL changes to
../MyApp/index.html#testPage
Im getting the old URL when I use window.location.href,i thought i would be getting the updated URL.And window.location.hash return an empty string.Is this because Im calling them at wrong event of the page?