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 27 times
0
E_net4 - Krabbe mit Hüten
- 24,143
- 12
- 85
- 121
Tris Yang
- 15
- 7
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
- 3,683
- 8
- 24