sa:='window.onbeforeunload = function(){return;} ';

(self.webbrowser1.Document as ihtmldocument2).parentWindow.execScript(sa,'JavaScript');