开发者

Can I suppress the authentication dialog in a Cocoa WebView?

开发者 https://www.devze.com 2022-12-11 22:07 出处:网络
I\'m using a Cocoa WebView开发者_开发知识库 object and I\'d like to suppress the authentication dialog that pops down when the user types in the wrong credentials. The server is sending back a Www-Aut

I'm using a Cocoa WebView开发者_开发知识库 object and I'd like to suppress the authentication dialog that pops down when the user types in the wrong credentials. The server is sending back a Www-Authenticate response header which I believe is triggering the dialog.

Can I somehow intercept this header before it triggers the authentication challenge? Or is there some other way to disable the challenge dialog?


Take a look at the WebResourceLoadDelegate. It has a method webView:resource:didReceiveAuthenticationChallenge:fromDataSource: that you can implement to intercept those WWW-Authenticate responses. Just make sure you call setResourceLoadDelegate: on your WebView to give it your delegate class where that method is implemented.

0

精彩评论

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