开发者

How can you redirect to a logon page for cross-domain requests?

开发者 https://www.devze.com 2023-03-11 11:39 出处:网络
In an application where I am making cross-domain JSONP requests (using jQuery), when the 开发者_如何学编程browser makes the first jsonp request, it pops up a dialog for basic authentication, because t

In an application where I am making cross-domain JSONP requests (using jQuery), when the 开发者_如何学编程browser makes the first jsonp request, it pops up a dialog for basic authentication, because that is what the target server requires. I would instead like to trap the event and bring up a dialog with a logon page from the server hosting the resource to establish authentication. How can I do this?


I agree with Adeel... it can't be trapped.

However, you can supply the required authentication header manually - to prevent the prompt from ever appearing - if the user has already "logged in" and you know their un/pw on the client side.


I think it is not possible, only option is to disable basic authentication and for end users, shouldn't that be disabled?


Per this thread How do I make a JSONP call with JQuery with Basic Authentication? it seems like you would need to proxy all the requests through server-side to detect and override http-level authentication challenges.

0

精彩评论

暂无评论...
验证码 换一张
取 消