Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 544123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:37:17+00:00 2026-05-13T10:37:17+00:00

The onerror page on MSDN states that the onerror handler can be attached to

  • 0

The onerror page on MSDN states that the onerror handler can be attached to a script element and that it “Fires when an error occurs during object loading.”.

For the purpose of unit tests, I am trying to get this onerror handler to fire, but could not find a suitable example.

The following code triggers an error in Firefox, but no alert is displayed in Internet Explorer

<script src="http://www.google.com/NOTFOUND.js" onerror="alert('error fired')"></script>

Does anyone know a value for script.src that would fire the handler attached to script.onerror?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:37:17+00:00Added an answer on May 13, 2026 at 10:37 am

    I found this buried in some MSDN documentation:

    Note that the documentation mistakenly says this works for elements too; the error will be fixed in the Workshop documentation for the final release of Internet Explorer 5 in March.

    The next thing I thought of that could help is the onreadystatechange event:

    <script src="http://www.google.com/NOTFOUND.js" onreadystatechange="alert(this.readyState)">
    

    This event fires twice for me, once with “loading” and again with “loaded”, whether the script is valid or not. Other documentation I’ve found says that sometimes it fires a complete event, and it’s not really clear when it’s supposed to fire. So it looks like that won’t work.

    So I think you’re left with the hacky solution of checking that a variable which the script is supposed to declare really exists. In HTML:

    <script src="http://yourdomain.com/declare_foo.js"></script>
    <script>if (typeof foo == "undefined") {alert ('error loading script');}</script>
    

    And then of course in declare_foo.js, you’d have

    var foo = 'Script loaded successfully';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have overridden OnError method in the page: public string script; protected override void
I have a dojo.xhrGet that return an correct array of object : <script type=text/javascript>
Application able to record error in OnError, but we are not able to do
I've got a page that lets you upload files. I've increased the maximum filesize
The silverlight object tag accept an 'onerror' parameter which calls back to a piece
I'm currently working on a page that loads several images sequentially using setTimeout and
I would like to set up an error page which will diplay a message
In my Application.cfc, I have an onError function that works great for all errors
I have an <iframe> that other sites can include so their users can POST
The link quoted on the EclipseLink/Maven wiki ends on an Error 403 page on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.