quirkey/sammy — pull request #134 by tdetoux (2012-04-10 02:43:54+00:00)
Title: Correct issue 125 : mailto links break Sammy get()

Hello,

This little commit corrects issue 125 : mailto links break Sammy get()
https://github.com/quirkey/sammy/issues/125

Note that in order to make the bug appears, you need not move to a mailto: url using the javascript way (window.location =) instead of using the standard href property.

The problem is that the onbeforeunload is triggered whenever the window.location is changed, whether it will cause a real page unload or not.

To solve this, I moved the Sammy unload function from the page's onbeforeunload to the onunload event, which is only triggered when the page is realy unloaded.