Here is a scenario:
- you can insert any HTML tags including <script>;
- you can not call any JS function (software/component does not have such functionality), and inserted script using innerHTML is not executed automatically.
After some lost time trying to come up with the solution, I found the following trick using image tag and onload attribute. Again if you try to use script tag, it will not work:
<img src="/images/1x1-transparent.png" onload="alert('testing');this.parentNode.removeChild(this);" />
Note that removeChild, will remove just inserted image, so your HTML code stays unaffected.
- Can scripts be inserted with innerHTML? (Stackoverflow)