Problem: When asking a browser window to reload, the POST object goes along with. This isn't user friendly (gives an annoying alert) and potentially bad by submitting data twice that should be sent once.
Solution: Instead of reload(), use "window.location.href = window.location.href". Yes, it looks idiotic but since the href is merely a string, this tells the location object to set to itself - but without the offending POST info.
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.
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.
Subscribe to:
Posts (Atom)