Use basic authentication with jQuery and Ajax

前端 未结 10 1065
野的像风
野的像风 2020-11-21 06:11

I am trying to create a basic authentication through the browser, but I can\'t really get there.

If this script won\'t be here the browser authentication will take o

10条回答
  •  一生所求
    2020-11-21 06:59

    JSONP does not work with basic authentication so the jQuery beforeSend callback won't work with JSONP/Script.

    I managed to work around this limitation by adding the user and password to the request (e.g. user:pw@domain.tld). This works with pretty much any browser except Internet Explorer where authentication through URLs is not supported (the call will simply not be executed).

    See http://support.microsoft.com/kb/834489.

提交回复
热议问题