15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2 ✦ Window and Frame Objects (Chapter 16)<br />

wintxt += “An error has occurred on this page. “<br />

wintxt += “Please report it to Tech Support.”<br />

wintxt += “”<br />

wintxt += “”<br />

wintxt += “Error: “ + msg + “\n”<br />

wintxt += “URL: “ + URL + “\n”<br />

wintxt += “Line: “ + lineNum + “\n”<br />

wintxt += “Client: “ + navigator.userAgent + “\n”<br />

wintxt += “-----------------------------------------\n”<br />

wintxt += “Please describe what you were doing when the error occurred:”<br />

wintxt += “”<br />

wintxt += “”<br />

wintxt += “”<br />

wintxt += “”<br />

errWind.document.write(wintxt)<br />

errWind.document.close()<br />

return true<br />

}<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Figure 2-2: An example of a self-reporting<br />

error window<br />

I provide a button that performs a hard reload, which, in turn, resets the window.<br />

onerror property to its default value. With error dialog boxes turned off, the errorhandling<br />

function does not run.<br />

141<br />

windowObject.onerror

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!