I am actually trying to enable user to bookmark pages and for this, i am using hash change event of javascript. Here is my code:
<script type="text/javascript">
function hashchk()
{
hashvalue=window.location.hash;
newhash="";
for(var i=1;i<hashvalue.length;i++)
{
newhash=newhash+hashvalue[i];
}
if(hashvalue!="")
{
window.location.replace("viewme.php?ppid="+newhash);
}
}
hashchk();
</script>
Everything here is working except for the fact that, when the user wants to go back to the previous page, he has to press the browser's back button 2 times rather than once.
if he is in http://www.example.com/abc.php#hello on 1st pressing back button, url alone changes to http://www.example.com/abc.php but the page does not load.
But on pressing it the next time, it comes properly. I want them to press it only once. Thanx in advance.