|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||HTMLViewer Mac||MBS MacControls Plugin||7.2||Yes||No||No||Yes, macOS only||No|
While loading a URL, WebKit asks the WebPolicyDelegate for policies that determine the action of what to do with the URL or the data that the URL represents. Typically, the policy handler methods are called in this order:
decidePolicyForNewWindowAction (at most once)
decidePolicyForNavigationAction (zero or more times)
decidePolicyForMIMEType:request (zero or more times)<BR>
New window policy is always checked. Navigation policy is checked for the initial load and every redirect unless blocked by an earlier policy. Content policy is checked once the content type is known, unless an earlier policy prevented it.
In rare cases, content policy might be checked more than once. This occurs when loading a "multipart/x-mixed-replace" document, also known as "server push". In this case, multiple documents come in one navigation, with each replacing the last. In this case, conent policy will be checked for each one.
All methods in this class will catch exceptions from Cocoa and raise a NSExceptionMBS instead. Using the message, name and reason properties you can see what was the reason for this exception. Please report if you find a method which does not handle exceptions correct.
Please use one delegate class per HTMLViewer (or WebViewMBS) and make sure they live about the same time. Our class keeps a reference on the WebView, so we can remove our delegate when the delegate is destroyed.
- 6 events
- event Close
- event decidePolicyForMIMEType(type as string,request as NSURLRequestMBS, frame as WebFrameMBS, decisionListener as WebPolicyDecisionListenerMBS) as boolean
- event decidePolicyForNavigationAction(request as NSURLRequestMBS, frame as WebFrameMBS, decisionListener as WebPolicyDecisionListenerMBS, NavigationType as Integer, ModifierFlags as Integer, OriginalURL as string) as boolean
- event decidePolicyForNewWindowAction(request as NSURLRequestMBS, framename as string, decisionListener as WebPolicyDecisionListenerMBS, NavigationType as Integer, ModifierFlags as Integer, OriginalURL as string) as boolean
- event Open
- event unableToImplementPolicyWithError(errorString as string, frame as WebFrameMBS) as boolean
This class has no sub classes.
Some useful global functions for this class:
Some methods using this class:
- HTMLViewer.InstallWebPolicyDelegateMBS(WebPolicyDelegate as WebPolicyDelegateMBS)
Some examples which use this class:
- /MacControls/HTMLViewer Mac/WebDownloadDelegateMBS Test
- /MacControls/HTMLViewer Mac/WebPolicyDelegate
The items on this page are in the following plugins: MBS MacControls Plugin.
MBS Xojo blog