I am working on a Cocoa WebView based browser application.
Basically, I would like to have it so when the user navigates to a url, for example:
http://a/b.php, by clicking on a link on the previous page of a website, my application intercepts the “on navigate” event and changes the URL to http://a/b.php?enableapi=1
Any ideas??
Thanks in advance.
You need to assign an object as the web view’s
WebPolicyDelegateand implement thewebView:decidePolicyForNavigationAction:request:frame:decisionListener:method.In that method, you must call one of the
WebPolicyDecisionListenerprotocol methods on the object that is passed as thedecisionlistenerparameter to the method. The threeWebPolicyDecisionListenerprotocol methods areignore,useordownload.You can then pass
ignoreto the listener and handle the link some other way for those links you’re interested in intercepting.