This is what I have…
a= document.createElement('div');
a.innerHTML="<script>alert(1)</script>";
document.body.appendChild(a);
The alert(1) doesnt get executed.
@rocket @m90 i know that, but i can’t use that method because i have a lot of other tags. Basically, I’m getting a webpage from ajax, striping off head tags, and embedding it into the document. Now the ajax data also has some script tags which i want to execute…
You should not use
<script>tags inside of.innerHTML. Instead you can just create a newscriptelement and do it just like this: