DISCUSSION A: Yes. Errors can be trapped from within the MenuBox container in the same way they would be managed in a browser. This includes errors resulting from external code execution. For example, you could add these three functions to your code:
function error_handler(msg,url,line)
{
return true;
}
function error_trapping_on()
{
window.onerror = error_handler;
}
function error_trapping_off()
{
window.onerror = null;
}
Then just invoke error_trapping_on() at the beginning of the code to suppress all error dialogs that may otherwise occur. When an error occurs, the error_handler() function, which serves no purpose other than to be called in case of errors, will be invoked, and future actions invoked by the user will continue to run normally. The above uses the onerror event, which is available in all versions of Windows supported by MenuBox. Alternatively, you may consider using the try... catch statement, which however requires at least Windows 98 SE, Windows Me, Windows 2000, or higher (or an older system with at least Internet Explorer 5 installed).
|