PDA

View Full Version : Ajax Tab Content Script (v 2.2)



swingtrader
01-06-2009, 08:23 AM
1) Script Title: Ajax Tab Content Script (v 2.2)

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

3) Describe problem: everytime i change the tab it always reload even though i were on the tab before, can it be saved?i mean when i first visit the tab off course it will load the content, but the next time i visit the tab again after i go to another tab, it won't reload because it's been loaded before..can it be done?
thx

ddadmin
01-06-2009, 09:09 AM
Are you talking about an Ajax fetched content, or IFRAME? With the former, you can disable busting of cache by modifying the code in red in the .js file:


bustcacheparameter=(ajaxfriendlyurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()

to just:


bustcacheparameter=""

For the later, try modifying the line:


window.frames["_ddajaxtabsiframe-"+contentdivid].location.replace(pageurl) //load desired page into iframe

to:


window.frames["_ddajaxtabsiframe-"+contentdivid].location=pageurl //load desired page into iframe

swingtrader
01-06-2009, 09:41 AM
both of them..
and btw i've edited the variable bustcacheparameter and window.frames
but it still doesn't work, it keeps on reloading the requested page of the tab..
is there anything else i should do?
thx

ddadmin
01-06-2009, 11:24 AM
Well, with the changes above, the browser will still load the requested tab's content each time, but it takes advantage of the browser cache so repeat requests should be from the browser cache, not a hard reload of the content. That's different from the script not requesting the content at all after the 1st time- there's no easy way to do this, since the content container area is overwritten each time with the active tab's content.

Now, Tab Content script (http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm) loads all the contents all at once and merely toggles between them for any subsequent requests.

swingtrader
01-07-2009, 07:23 AM
ok thx admin...
Gbu