salut tout le monde

je suis novice en js
j'ai voulu capturer l’évènement onbeforeunload puis lancer la boite ''set as homepage" :

voici ma tentative :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html> 
<head>
<title>Catching OnClose Event To Set Home Page</title>
</head>
<SCRIPT language=JavaScript> 
function MsgOkCancel() 
{ 
 window.setHomePage('http://www.monsite.fr');
}
</script>
 
<body window.onbeforeunload="javascript:MsgOkCancel();">
</body> 
</html>
ça n'a pas marché
y'a t-il qq qui peut m'aider