How to bind to an Iframe to the unload event (beforeunload).

$("#iframeId").get(0).contentWindow.onbeforeunload = function(e) {
    debugger;
    log("onbeforeunload:e", "debug", e);
};