Welcome Guest, Not a member yet? Register   Sign In
Dynaimcally changing URL without reloading a page
#1

[eluser]Josamoto[/eluser]
Hi all, and may I wish you all a Happy 2008!

I have a website that is run by CodeIgniter, Smarty and the JavaScript Ext 2 library. I just wanted to ask if it is possible to change the URL of a webpage, dynamically, but without having the entire page reload.

My web app has 5 tabs/menu buttons linking to 5 sub-pages. A click on each of these 5 buttons requests, via AJAX, the content to be loaded in my <div id="content_wrapper"></div> section. The result is that the page does not reload after each page change, so it does not reload for example CSS and JS that are not cached by the browser. The header and footer remains static with only the content section changing.

What happens is my site remains on the initial URL, http://www.cijoe.net/. So navigating to a new page does not change the URL to for example www.cijoe.net/home.html as I am using AJAX. I want the URL to change upon the AJAX request, but the page must not reload. Possible or should I abandon quest?

I think my request sounds impossible, but it's worth a try. Thanks for the help in advance! Smile
#2

[eluser]Phil Sturgeon[/eluser]
It is not possible to change the URL without loading a new "page". That is essentially what a URL points to, a new page...

So yes, abandon your plans sir, sorry!
#3

[eluser]Wuushu[/eluser]
But it's possible to change the hash value. (#tab1) without reloading the page, and done from javascript.

Your ajax content functions could then see first if there is a value in the hash, and load the according page. should a user want to link directly to one of your tabs.
#4

[eluser]xwero[/eluser]
I believe i read on the jquery mailing list that safari goes in endless load state if you change the hash via javascript.
#5

[eluser]Wuushu[/eluser]
[quote author="xwero" date="1199578367"]I believe i read on the jquery mailing list that safari goes in endless load state if you change the hash via javascript.[/quote]

Ouch! Thanks for letting us know!
#6

[eluser]Josamoto[/eluser]
Thanks for the replies. I guess all that hard work to get pretty URL's has pretty much gone out the door, since AJAX is a bigger priority.

Win some, lose some I suppose. Smile
#7

[eluser]pims[/eluser]
You may want to take a look at SWF address (http://www.asual.com/swfaddress/), this might be useful.
#8

[eluser]Josamoto[/eluser]
Thanks for the link pims. I see it's your first post here. It's really kind of you to spend it on my thread! Hee hee! Smile
#9

[eluser]pims[/eluser]
You're welcome. I've used this javascript library on a couple of (flash) websites, and it worked like a charm. Don't forget to send us the link once you're done ;-)
#10

[eluser]Josamoto[/eluser]
Man this lib is great. It's just what I need. I was worried that my SEO was gonna go down the drain as I use AJAX in nearly all my applications.

I'll definitely post the link once the site is done and the customer is happy. Smile




Theme © iAndrew 2016 - Forum software by © MyBB