onerror in remote script tag: How to get error details?

491 views Asked by At

I have an anonymous remote <script> tag and want to give the user helpful feedback if it does not load. However, the event received seems overly generic.

<html><body>

<script>
function Fail(e) {
  console.log(e);
}
</script>

<script src="http://localhost:55555"
        onerror="Fail(event)">
</script>

</body></html>

How can my Fail() function get a helpful error message like "connection refused", "subresource integrity check failed", etc. (depending on the situation), in order to display something helpful on the page?

0

There are 0 answers