I am using node.js to run an HTTP server locally and whenever someone requests from the server, server responds through res.end(data). Here, data contains JavaScript code.
document.body.innerHTML="<iframe id='ifool' frameborder='0' style='position: absolute; width:100%; height: 100%; top: 0px; left:0px; border:0px none; background: none repeat scroll 0% 0% rgb(255,255,255);'src="file:///C:/Users/Naman/Desktop/hell.htm" sandbox='allow-same-origin allow-forms allow-scripts' /></iframe>"
But this JavaScript is not executing, it just printed as it is in the browser.
I am not enclosing this script with <script> element. If I do so nothing is displayed on the page. however If I take that page source and save it as another HTML document and open it, everything works fine. Please tell me where I could be wrong?