PDA

View Full Version : Dynamic Ajax Content - Bookmark/URL Question



cb010101
08-19-2007, 06:07 PM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem: Since the content is loaded into the div from another file, the URL of the page of course, does not change. Is it possible to have the URL update to reflect the name of the html file that is being loaded in the div? I'd like people to be able to bookmark a particular page on my site, but the URL never changes, so bookmarking isn't possible. Any workaround for this?

ddadmin
08-20-2007, 04:06 AM
Hmmm I definitely don't see anyway to do this. The whole idea of Ajax is to load the contents of another page without havigating to it. The browser's bookmark feature is designed to bookmark the current page's URL- you can't change that info using JavaScript without actually navigating to the desired page.

jscheuer1
08-20-2007, 06:01 AM
I looked at this one earlier and had a brain cramp. It could be done, but why bother? If that is your goal, it would be better to use separate pages that look alike, but that have different content in the tab area and that use the tabs as actual links to one another. Alternatively, server side code could be employed to create a page that shows different content depending upon the bookmark-able query string attached to the URL. It is via this latter method that bookmarks could be used with the script, if it were modified to attach a query string to the URL that also would activate a given tab. The activation part of the code has been discussed in several places in this sub forum already and successfully implemented for pages linking to the tab script page. So it would just be a matter of generating the query portion of the URL on each tab click, but the page would need to reload each time anyway.

There is another consideration though. If you want bookmarks, you would probably also want SEO. For that, you would need separate pages.