Voici un code que j'avais écris a l'université... ne me demandé pas comment je l'ai fait... je devais être trop saoul pour m'en rappeler. La bonne nouvelle c'est que ça marche.
-------------------------------
<csactions>
<csaction name="409AA419" class="Close Window" type="onevent">
</csactions>
<csscriptdict>
<script><!--
function CSClickReturn () {
var bAgent = window.navigator.userAgent;
var bAppName = window.navigator.appName;
if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
return true; // dont follow link
else return false; // dont follow link
}
CSStopExecution = false;
function CSAction(array) {
return CSAction2(CSAct, array);
}
function CSAction2(fct, array) {
var result;
for (var i=0;i<array.length;i++) {
if(CSStopExecution) return false;
var actArray = fct[array[i]];
if(actArray == null) return false;
var tempArray = new Array;
for(var j=1;j<actArray.length;j++) {
if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
if(actArray[j][0] == "VAR") {
tempArray[j] = CSStateArray[actArray[j][1]];
}
else {
if(actArray[j][0] == "ACT") {
tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
}
else
tempArray[j] = actArray[j];
}
}
else
tempArray[j] = actArray[j];
}
result = actArray[0](tempArray);
}
return result;
}
CSAct = new Object;
function CSCloseWindow() {
if (self.parent.frames.length != 0) {
self.parent.close()
} else {
window.close()
}
}
// --></script>
</csscriptdict>
<csactiondict>
<script><!--
CSAct
'B65B835F35' = new Array(CSCloseWindow);
CSAct
'409AA419' = new Array(CSCloseWindow);
// --></script>
</csactiondict>
<a href="#" onclick="CSAction(new Array(/*CMP*/'409AA419'));return CSClickReturn();" csclick="409AA419">FERMER CETTE PAGE</a>