window.onbeforeunload = function () {
executemyfunc();
}