2

I am using jquery.pngFix.js to fix IE6 transparency for png. I am pulling it at the header the following way and then calling the function in separate .js file:

<!--[if IE 6]>
<script src="/js/jquery.pngFix.js" language="javascript" type="text/javascript"></script>
<![endif]--> 

but my page just gets frozen in IE6 sometimes, like it cant load something but there is no errors and nothing is missing although if i disable the jquery.pngFix.js the problem is gone. Has anyone ever met such issue with that plugin?

The only solution i could come up with for now is to place the plugin right at the bottom of the page to wait until the page is loaded and it seems to work for me but i wonder if there is a better way of doing this?

<script src="/js/jquery.pngFix.js" language="javascript" type="text/javascript"></script>   
<script>jQuery(function(){if ($().pngFix) {$(document).pngFix();}});</script> 

Thanks.

devjs11
  • 1,898
  • 7
  • 43
  • 73
  • 1
    Easy solution: Do not support IE6 :) – ThiefMaster Feb 16 '11 at 15:15
  • Are you trying to load the pngFix script file before jQuery? That won't work! – Matt Ball Feb 16 '11 at 15:16
  • 2
    @ThiefMaster, I am assuming you meant that as a joke, but just in case others don't read it that way... There are times when you may need to do this. There is still a large subset of users using IE 6. At the very least, your page should load and the content be viewable. If these PNGs are minimal, it likely isn't a huge problem. However, if they are significant or part of the primary content, then supporting IE 6 and other old browsers is important. – Brad Feb 16 '11 at 15:27
  • @Brad agree! thats the point. – devjs11 Feb 16 '11 at 15:35
  • Actually, I was kind of serious - if all pages (especialyl large ones like Google, Amazon, Ebay) blocked out IE6, it would die quickly. – ThiefMaster Feb 16 '11 at 15:38
  • @ThiefMaster, I don't know the background of your sites' users, but I can tell you that the general populous has a large subset of it that still uses IE 6, among other old browsers. You really should widen your view of the world of users. It is easy for us developers to keep up with technology, but assuming everyone can do that is simply arrogance. – Brad Feb 16 '11 at 15:48
  • @ThiefMaster, Rarely is there a reason *not* to support a browser like IE6. If you have specific functionality of your site that requires a more modern browser, then fine. But if you can spend 5 minutes of effort making your site work for a larger audience, then it is generally worth your time to do so. Most of today's sites aren't actually all that complicated. You don't necessarily have to compromise on usability, accessibility, or standards-compliant to make your pages work with old browsers. Yes, sometimes it can be difficult, but the effort is usually worth it. – Brad Feb 16 '11 at 15:51
  • I agree, if it's easily possible it's not a bad think to make it work. However, the fact that we need to support a 10-year-old browser which lacks some of the most basic things, is a shame. – ThiefMaster Feb 16 '11 at 15:58
  • IE6 currently accounts for 3.8% of the browsers out there, although check your analytics since your numbers may vary. Not exactly a massive segment, but still it accounts for some users. Anyway getting back to your problem: how many PNGs are on your page? – Mike Robinson Feb 16 '11 at 16:17

1 Answers1

1

Anyway getting back to my problem :) I came up with the following fix:

$(window).load(function(){
        //Png fix.
        if ($().pngFix) {
            $(document).pngFix();
        }   
});

So, issue solved, that will wait till the whole document actually is loaded and then fire the pngfix.

devjs11
  • 1,898
  • 7
  • 43
  • 73