The following is a routine to download content of a file.
It works fine except for the error handling. When login info is incorrect the following generic javascript window pops up.Code:var req = new XMLHttpRequest(); req.open( 'GET', 'ftp://username:[email protected]/index.html', true ); req.onreadystatechange = function() { if( req.readyState == 4 ) { print( req.responseText ); } } req.send( null );
When the file does not exits, it will pop up the following.Code:530 Login Incorrect
What I want to do is to suppress the generic error window and its message with my own. So how do I capture the type of error (error 530, 550, etc), and how do I prevent the generic javascript erro window from popping up?Code:550/index.html No such file or directory