I’m trying to receive the shouldStartLoadWithRequest message from a WebView in an applescript/objective-c OSX application.
The applescript I would like to receive the message with:
on webView_shouldStartLoadWithRequest_(request, navigation_type)
log "should start!"
return yes
end webView_shouldStartLoadWithRequest_
I am led to believe that I have the wrong delegate connections in the IntefaceBuilder, but I’ve tried everything which looks plausible and still no luck.
downloadDelegate --> MyApp App Delegate
frameLoadDelegate --> MyApp App Delegate
resourceLoadDelegate --> MyApp App Delegate
UIDelegate --> MyApp App Delegate
No luck so far. However, I have other messages working correctly (e.g. webView_didStartProvisionalLoadForFrame_ works fine).
What do I need to connect or add to receive this event? I’m very new to this type of programming, so apologies if I’m missing something obvious.
Thanks so much!
You’re probably doing everything right, but the message isn’t being received because it isn’t being sent.
webView:shouldStartLoadWithRequest:is not a method in any web view delegate protocol on OS X. (It does exist on iOS.)I’m not at all familiar with those various delegate protocols, but depending on what you’re trying to accomplish, it seems that either
webView:resource:willSendRequest:redirectResponse:fromDataSource:or possiblywebView:decidePolicyForNavigationAction:request:frame:decisionListener:may be useful.