Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-10-2008, 09:38 PM #1
- Join Date
- Nov 2006
- Thanked 0 Times in 0 Posts
Change address bar for AJAXed links
I'm sure this is coming up quite a bit so maybe someone's got the answer...
How does one change the text of the address bar to reflect a page change implemented with AJAX?
//HOME PAGE URL http://www.mysite.com //INSIDE PAGE http://www.mysite.com/?page=contact
NOTE: using window.location.hash is not an option as I need to pass a variable for PHP reasons. Any non-hash alternatives?
03-11-2008, 01:42 AM #2
- Join Date
- Jun 2007
- Thanked 619 Times in 599 Posts
using the search param (?), instead of the hash (#) will cause all current browsers to refresh the page, not something i think you want.
so, in order to use a url, it would have to be a hash.
this means that you need to create a 'landing page'- a simple html/js page the immediately converts the hash to a search and transfers the url to your php script.
note that this would be incoming only; bookmarking a dynamic page would use the search, not the hash. make sure your server can find both versions.
one more idea: use ?s and a full-screen iframe to show your content. the hash of your top page can change while the search of the iframe changesCreate, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com