catch javascript errors in any output

not just javascript.

catches js errors appending anything to the output area, such as js in HTML (#4095).

closes #4095