I am using kind of this solution to execute <script>
that is inserted via innerHTML
, but I need to make sure, those scripts are executed only once. So my question is:
Can I be sure that scripts will not be executed when inserted via innerHTML and why?
EDIT: I need a solution where I can put scripts into a div, that will not be executed when inserted. I want to parse these scripts and execute them by another code snippet. I have a solution that is using innerHTML to insert script-tags into a div and it is working good.
What would be the appropiate way to insert scripts into a div without having them executed when inserted?