3 ms·
I imagine for fear that Evil Script would trap the error. An infinite loop precludes any transfer of control. Theoretically.
by mgsouth 4y ago
I imagine for fear that Evil Script would trap the error. An infinite loop precludes any transfer of control. Theoretically.
- jraph 4y agoYes, I think you could catch the error with window.onerror or script.onerror and in this handler, get the content with script.textContent or script.innerHTML. (where script is the javascript variable that corresponds to the javascript script tag, possibly initialized with script = document.createElement('script'))