CSS3 PIE Forums
http://css3pie.com/forum/

PIE causes duplicate downloads on files
http://css3pie.com/forum/viewtopic.php?f=3&t=147
Page 2 of 2

Author:  jason [ Sun May 29, 2011 4:44 pm ]
Post subject:  Re: PIE causes duplicate downloads on files

@admintiger: That should not be the case. Browsers other than IE do not recognize the behavior property so they do not download the file at all. Unless you're referencing it in some strange way.

Author:  admintiger [ Sun May 29, 2011 8:55 pm ]
Post subject:  Re: PIE causes duplicate downloads on files

I did some experimenting after my previous post and found that loading pages locally with Firefox, Chrome, Safari or Opera does not result in requests to the server for pie.htc. Even so, server log records clearly show the file being requested by other users where user agent strings identify web browsers other than IE. I wonder whether that might be due to intermediate proxy servers downloading all files referenced in CSS files to ensure that complete file sets are cached.

Author:  admintiger [ Mon May 30, 2011 9:23 am ]
Post subject:  Re: PIE causes duplicate downloads on files

THE CAUSE:
I was able to determine with some testing that IE loads pie.htc and executes the init() function on 'oncontentready' or 'ondocumentready' events. However, the file contents are not cached by IE during initialization. Later other functions are separately loaded as needed, resulting in multiple pie.htc downloads.

THE FIX:
I was able to fix the problem by coercing IE into preloading the full pie.htc file prior to stylesheet loading in the web page header, like this:
Code:
<!--[if IE]>
<link href="/path to/pie.htc" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="/path to/style.css " rel="stylesheet" type="text/css" />

Note that it is necessary to lie to IE about the pie.htc data type being "text/css". Type="text/x-component" will not work. Neither will type="text". IE must "think" pie.htc is a stylesheet for the trick to work.

That simple fix causes IE to load pie.htc only once.

Page 2 of 2 All times are UTC - 7 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/