Compartilhar via


Script URL will no longer work in a meta tag after installing 956390 on IE6

Hi everyone!

It’s Shahinur again with another blog that I hope you find informative…

I was working on an issue lately where window.close() no longer seemed to close a window. This started happening after installing the October 08 IE Cumulative update MS08-058 (KB956390).

This was the code being used to close the window:

<HTML><HEAD>
<SCRIPT>
function FinalCode(){
window.close();
}
</SCRIPT>

<META http-equiv=Refresh content="2 URL=javascript: FinalCode ();"></HEAD>  <============================
<BODY><BR>
<DIV class=body align=right>Closing</DIV></BODY></HTML>

Notice that a javascript: URL is being used in the meta tag to call in the function that will close the window. This essentially is the crux of the problem.  In KB956390, we have added some code to prevent navigation to script URLs for security reasons. 

The solution is simply not to use javascript:URL.  Instead, you can use the onload event handler and call the window.close() function from there:

<HTML><HEAD>
<SCRIPT>
function FinalCode(){
window.close();
}

function closeWin()
{
       window.setTimeout("FinalCode()", 2000); //after 2 sec call the success() function to close the window
}
</SCRIPT>
</HEAD>
<BODY onload=closeWin()><BR>
<DIV class=body align=right> Closing </DIV>
</BODY>
</HTML>

Regards,

The IE Support Team