The syntax error on this page comes after the onerror event handler is defined, so the custom dialog catches it.
onerror
Note: This may not work in newer browsers with tighter security restrictions.