Create XHR and open with username and password passed in. Server replies with 401 and Basic Authentication Scheme Instead of replying with credentials behind the scenes, A dialog pops up asking for user credentials and hence blocking javascript execution.