You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Josh Long <st...@gmail.com> on 2006/08/25 21:18:55 UTC

tapestry ajax IE image caching and headers...

I'm using tapestry with ajax and a significant amount of images and
only in this light in IE has a caching bug cropped up.

What's the most approrpiate place to set a header of

    Cache-Control: post-check=900,pre-check=3600

in tapestry for images? Is it conceivable that the asset service could
be usefully changed from outside? Would I just add it to the headers
of my otherwise very dynamic pages? Heck, from where is it in even
safe to issue a httpservletresponse.setHeader? prepareForRender ? Are
there better ways of doing this (namely telling iE to cache all my
images even if theyre inserted via ajax? )

Thanks,

Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry ajax IE image caching and headers...

Posted by Josh Long <st...@gmail.com>.
It's good having folks like you around Jesse! Thanks for the quick
reply (as always).

Here's what little i know thus far: apparently IE has a bevy of bugs
that proclude it from usefully loading images via ajax without some
extra help. One such bug is that if you dynamically create an image,
(x=document.createElemenet('img') ; x.src  = 'foo.jpg' ; or via
innerHTML, etc) it doesnt consult the cache for the asset. It reloads
it each time.

Apparently, if you specify a css background thats not "really"
relative it desnt get cached either. eg: /images/foo.jpg would not be
cached if used as the value for url(...) in say a background-image
declaration. ../../images/foo.jpg _amazingly_ would be cached.

Naturally, none of this siliness is a problem with
safari/opera/firefox/lynx/me when i close my eyes after a large cup of
coffee and imagine http headers a' working...

http://mir.aculo.us/articles/2005/08/28/internet-explorer-and-ajax-image-caching-woes
better explains the problem and the solution (err, well, as its in
ruby, some assembly may be required..), and in particular it links to
http://msdn.microsoft.com/workshop/author/perf/perftips.asp#Use_Cache-Control_Extensions

Apparently the 1-2 punch of the e-tag (que?) and the proprietary IE
caching control extensions (post create / pre create) trigger IE to
consult the cache even for dom creation... if the moons in the right
phase and alignment....

Also, in a related vein, I read that google maps on IE has to
redownload the assets for things like the pinpoint image and so on.
This makes the performance of maps with a lot of pinpoints really
slow. The solution, according to the post I was reading was literally
just writing the assets onto the page as <img style = "display:none;"
src = "..."  />.

My scenario is this: I have a dojowidget which renders a lot of
images. The widget itself is rendered 20 times a page. AND, inside the
widget (its a container), there are google maps. AND, paging happens
via ajax which means those 20 widgets are rendered againg and
downloaded again  without discarding the first 20 (btw, how would i
attach a client side routine to a server side listener... err.. that
is, when i use tapestrys event listener, before the server side code
is run, id like to have a chance to do cleanup, maybe unload nodes, or
something.. If the js thats renderede when the ajax comes back has no
sense of the context of the page, then I cant write it to unload any
existing stuff and then load the new stuff.. ow..)! At this point, and
not a second sooner, IE actually flipped me the birdy.

So for that solution, there are no assets, per se. Its just straight
html and relative paths.. so im trying the technique of just
hardcoding the images via <img src= "" style = "display :none;" />
just once so the browser has a chance to cache it.

I'm testing htat right now..

So... thats what I need. :-) aren't you sorry you asked. I don't even
know how this would work!

if there were some way of providing the shell with an collection of
objects that wrapped header information, any component could
contribute a header (for example my tapestry wrapper around my dojo
widget would have a chance before render to add() an object to the
collection of headers to be rendered and my page wouldnt need to know
about it.

The asset service is a fine place to create a specialized hivemind
contribution, but im just worried about how to support the images not
loaded via the asset service that sitll need caching enabled.

Anyway, any help is most assuredly appreciated.

Peace,
Josh





On 8/25/06, Jesse Kuhnert <jk...@gmail.com> wrote:
> Or you could just tell me what you need and I can add it :)
>
> I'm especially interested in making caching/anything to do with AssetService
> better.
>
> Can you elaborate more on what these post/pre check parameters are for and
> which browsers/content types they apply to?
>
> On 8/25/06, Josh Long <st...@gmail.com> wrote:
> >
> > I'm using tapestry with ajax and a significant amount of images and
> > only in this light in IE has a caching bug cropped up.
> >
> > What's the most approrpiate place to set a header of
> >
> >     Cache-Control: post-check=900,pre-check=3600
> >
> > in tapestry for images? Is it conceivable that the asset service could
> > be usefully changed from outside? Would I just add it to the headers
> > of my otherwise very dynamic pages? Heck, from where is it in even
> > safe to issue a httpservletresponse.setHeader? prepareForRender ? Are
> > there better ways of doing this (namely telling iE to cache all my
> > images even if theyre inserted via ajax? )
> >
> > Thanks,
> >
> > Josh
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> Jesse Kuhnert
> Tapestry/Dojo/(and a dash of TestNG), team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry ajax IE image caching and headers...

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
On the topic of Cache-Control:, I think it would be nice to be able to make 
the data model provide the basis for time-to-live. I'm thinking
@Table model etc.

Henrik

"Jesse Kuhnert" <jk...@gmail.com> skrev i en meddelelse 
news:7926817e0608251225l4a2ab0c0x25371b83f581ba86@mail.gmail.com...
> Or you could just tell me what you need and I can add it :)
>
> I'm especially interested in making caching/anything to do with 
> AssetService
> better.
>
> Can you elaborate more on what these post/pre check parameters are for and
> which browsers/content types they apply to?
>
> On 8/25/06, Josh Long <st...@gmail.com> wrote:
>>
>> I'm using tapestry with ajax and a significant amount of images and
>> only in this light in IE has a caching bug cropped up.
>>
>> What's the most approrpiate place to set a header of
>>
>>     Cache-Control: post-check=900,pre-check=3600
>>
>> in tapestry for images? Is it conceivable that the asset service could
>> be usefully changed from outside? Would I just add it to the headers
>> of my otherwise very dynamic pages? Heck, from where is it in even
>> safe to issue a httpservletresponse.setHeader? prepareForRender ? Are
>> there better ways of doing this (namely telling iE to cache all my
>> images even if theyre inserted via ajax? )
>>
>> Thanks,
>>
>> Josh
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> -- 
> Jesse Kuhnert
> Tapestry/Dojo/(and a dash of TestNG), team member/developer
>
> Open source based consulting work centered around
> dojo/tapestry/tacos/hivemind.
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapestry ajax IE image caching and headers...

Posted by Jesse Kuhnert <jk...@gmail.com>.
Or you could just tell me what you need and I can add it :)

I'm especially interested in making caching/anything to do with AssetService
better.

Can you elaborate more on what these post/pre check parameters are for and
which browsers/content types they apply to?

On 8/25/06, Josh Long <st...@gmail.com> wrote:
>
> I'm using tapestry with ajax and a significant amount of images and
> only in this light in IE has a caching bug cropped up.
>
> What's the most approrpiate place to set a header of
>
>     Cache-Control: post-check=900,pre-check=3600
>
> in tapestry for images? Is it conceivable that the asset service could
> be usefully changed from outside? Would I just add it to the headers
> of my otherwise very dynamic pages? Heck, from where is it in even
> safe to issue a httpservletresponse.setHeader? prepareForRender ? Are
> there better ways of doing this (namely telling iE to cache all my
> images even if theyre inserted via ajax? )
>
> Thanks,
>
> Josh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo/(and a dash of TestNG), team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.