I'm wondering if there is a way to change the URL that is displayed in a browser that does not support HTML5? I update some pages using AJAX, so it would be useful to be able to do this to allow users copy and paste links.
Thanks.
I'm wondering if there is a way to change the URL that is displayed in a browser that does not support HTML5? I update some pages using AJAX, so it would be useful to be able to do this to allow users copy and paste links.
Thanks.
Usually, website programmers that want to change the site URL when using AJAX, add a hash to the URL (#) and then a page component specific URL.
To change the hash itself use window.location.hash
.
However, since the browser does not send the hash portion of the URL to the server, you'll need some code to send that part explicitly to the server to fetch the right content.
There are several jQuery plugins that deal with this issue, for example http://plugins.jquery.com/plugin-tags/hash, and there are many questions here that deal with the subject:
Getting URL hash location, and using it in jQuery
Encoding of window.location.hash
Parsing URL hash/fragment identifier with JavaScript
These are just a few examples.