0

Input: source html file, with JavaScript code and with possible errors in web content. Output: JavaScript code, that will print in alert the first error it can catch, after injecting into source html file.

I need to catch all errors that might pop up on web page by using JavaScript, here is non-exhaustive list of errors I need to register:

  • JavaScript errors
  • all image errors(image is not available, etc.)
  • iframes errors(source is not available, etc.)
  • other errors

On the first iteration it will be perfect to catch just JavaScript errors(can be done with window.onerror) and Image source errors.

4

1 Answer 1

0
window.onerror = function(msg) {
    alert('Error message: '+msg');
    return true;
}

For the list of error u should initialise an array and push all the error to that and finally check that array periodically. once the error shown in popup clear the data.

Hope it helps u.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.