How to provide user-friendly webpage to the client | Error handling with onerror in javascript| how to avoid the error message.


Some times the script refers to the location that existed at special location when the script was written, but the location change at the later time so the loading script is invalid. In these case browser is display the error message to the client user, so the user confused with the error message. To prevent error dialog box to handle error with onerror event.By through using this onerror event it will display there error message in the browser status bar.Note: this program work correctly if “script debugging” is disabled in browser. how to disabled
Tool->internet option->advance tab->disable script debugging under browsing
How to provide user-friendly webpage to the client  Error handling with onerror  how to avoid the error message.
Error: alrt("welcome to our page");
This code has error alrt so it will display error message in the status bar.
<html>
<head><title>STUDENTWEBSITE</title>
<script language="javascript">window.onerror=handleError;
function okp()
{
alrt("welcome to our page");
}


function handleError(errType,errURL,errLineNum)
{ window.status="Error:"+errType+"online"+errLineNum;
return true;
}
</script>
</head><body onload="okp()"></body>
</html>



Post a Comment

0 Comments