catch any errors that occur when trying to open a new window from javascript