treeleaf20 Posted November 9, 2009 Share Posted November 9, 2009 All, If I have the following URL: http://example.com/viewpage.php?id=test Then when I write a hash the URL goes to: http://example.com/viewpage.php?id=test#id=nexttest I have the following code: function redirectHash() { var hash = location.hash; if (hash){ hash = hash.replace('#', ''); location.href = hash; } } </script> Currently this code would try and redirect me to http://example.com/id=nexttest How can I get it so that it keeps everything before the ? and just updates the id part? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
treeleaf20 Posted November 10, 2009 Author Share Posted November 10, 2009 Also I have that and then call this function when the page loads in the body onload command. It will load the original page and then switch the url and load it again. How can I get it so that it does the url and then load the page? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.