I tried to load some scripts into a page using innerHTML with a div. It appears that the script loads into the dom, but it is never executed (at least in ff and chrome). Is there a way to have scripts execute when inserting them with innerHTML?
sample code
<!DOCTYPE html>
<html><head>
<title>test</title>
</head>
<body onload="document.getElementById('loader').innerHTML = '<script>alert(\'hi\')<\/script>'">
Shouldn't an alert saying hi appear?
<div id="loader"></div>
</body></html>