Can I suppress the authentication dialog in a Cocoa WebView?
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.
精彩评论