The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Sleight PNG JS and Crashes

I've been using YoungPup's Sleight Javascript code to force MSIE to render PNG alpha transparency correctly, and have noticed that a 1 in 20-30 refreshes results in a MSIE crash. (If this happens to my clients I CANNOT allow this; I don't want a site with a reputation of crashing my client's browser)

Here is the code, that's for free download; I was hoping someone could look it through and give me thoughts on any code that may be "iffy" Also, can you provide me with a variation that would pause the operation of the script for, say, 1 second, before it runs; I want to see if the fact that it does this too fast is causing some kind of overflow. Thanks

Have you read through Sleight's code? Is the fnLoadPngs() function the one that would cause problems, or would it be the alphaBackgrounds() function? Where do I place that code? Before or after the functions? I assume since it's not in a function itself, that code would be fired off on each page load. Or would that code alone wait 1 second and then fire off the function once?? (as opposed to a setInterval, if such exists)

When I temporarily disable the Sleight JS code, the transparency is gone and I don't crash. (was up for 2 days, no crashes) When I re-enable it I crashed 3 times that day.

I actually tried to use the code you showed me Mr.B, and it DOES take care of CSS' backtround-image when it's a PNG, but it alone ignores inline PNGs that the original Sleight DOES take care of. I placed both into one JS file and they take care of PNGs properly together.

Maybe that's where the error is coming in. Something is getting applied to PNGs twice and causing browser errors. I will contact him and inform him of the issue to see if they can combine the code to go over the PNGs only once AND check for inline and CSS PNGs.