Monday, January 22, 2007

Hack #1: Keeping Safari From Crashing Itself

Problem: When javascript from an iframe asks to close the layer containing the iframe, Safari (2.0 at least) crashes. Best guess is that this is because the HTML node which actually triggers the executable javascript is suddenly not there when the javascript enters some kind of return.

Solution: Don't let the iframe do the work. Set a timeout and let the container window trigger the javascript to close the window. Works the same in the end, cross-browser friendly and keeps Safari from crashing.

No comments: