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.
Asked
Active
Viewed 41 times
0
1 Answers
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