Eval Script Tags in Ajax Response

I found this code after many research, and back

function parse_script(str)
{
var scripts = (str.match(/]*)>([sS]*?)</script>/g));
if (scripts && scripts.length)
{
for(var i=0;i
{
var arr = scripts[i].match(/]*)>([sS]*?)</script>/im);
var s;
if (YAHOO.env.ua.ie > 0)
{
s = document.createElement('SCRIPT');
s.text = arr[2];
}
else
{
s = document.createElement('script');
s.appendChild( document.createTextNode( arr[2] ));
}

document.getElementsByTagName(“head”)[0].appendChild(s);
}
}
}

Advertisements