handle 404 and other error request on node-webkit

I want to create a sort of modified intelligent browser with node-webkit and i wanted to modify the behaviour of my browser when 404 or other type of request error become. For example my application have a HTML button that ask for a remote page that will be unavailable. Instead of present a normal 404 page (like the chrome one) I need to handle this and do something (like for example logging the error, present a local page or something else). It's possible to override the normale behaviour of node-webkit and how? Thanks,

There isn't an easy way to change the behaviour of webkit windows as you describe, but you could solve your problem by first attempting to load the page via http.get and if it fails, open your new window with your own custom 404.html. If it succeeds, either open the window on the same url.

No, it's not very efficient but it would work.

I can think of other solutions (like document.write() the retrieved contents to a new blank window, or writing a reverse proxy to provide your custom 404 page in the event the target doesn't exist), but retrieving the page first without opening a window is the simplest.