0

So, I was adding some new js code to body and i notice that if you add with $('body').append(), it works but when i tried to add with document.body.innerHTML+="some script", It doesn't run.

E_net4
  • 27,810
  • 13
  • 101
  • 139
Tris Yang
  • 15
  • 7

1 Answers1

0

HTML5 specifies that a <script> tag inserted with innerHTML should not execute.

Have a look at Element.innerHTML - Security considerations and the specification.

hangindev.com
  • 4,573
  • 12
  • 28