Platforms to show: All Mac Windows Linux Cross-Platform
WKWebViewControlMBS control
See also desktop control: DesktopWKWebViewControlMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
control | WebKit2 | MBS Mac64bit Plugin | 16.4 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Example:
// print a WKWebViewControlMBS to PDF file:
dim browser as WKWebViewControlMBS // your control showing website
Dim pi As NSPrintInfoMBS = NSPrintInfoMBS.sharedPrintInfo
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.pdf")
pi.SetSaveDestination f
Dim po As NSPrintOperationMBS = browser.printOperation(pi)
po.showsPrintPanel = False
po.showsProgressPanel = False
If po.runOperation Then
f.launch
End If
This is a control to use WebKit in 32-bit and WebKit 2 in 64-bit.
Most of the events provided by Xojo for the control will not work.
But we can add features over time as needed.
Let us know if you need a method from WKWebView or an event from WKNavigationDelegate or WKUIDelegate.
- 48 events
- event BoundsChanged
- event Close
- event Closing
- event ConstructContextualMenu(base as MenuItem, x as Integer, y as Integer) as Boolean
- event ContextualMenuAction(hitItem as MenuItem) as Boolean
- event CreateWebView(URL as String, request as NSURLRequestMBS) as Variant
- event decidePolicyForNavigationAction(navigationAction as WKNavigationActionMBS, decisionHandler as WKPolicyForNavigationActionDecisionHandlerMBS)
- event decidePolicyForNavigationResponse(navigationResponse as WKNavigationResponseMBS, decisionHandler as WKPolicyForNavigationResponseDecisionHandlerMBS)
- event DidClose
- event didCloseContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- event didCommitNavigation(navigation as WKNavigationMBS)
- event didFailNavigation(navigation as WKNavigationMBS, Error as NSErrorMBS)
- event didFailProvisionalNavigation(navigation as WKNavigationMBS, Error as NSErrorMBS)
- event didFinishNavigation(navigation as WKNavigationMBS)
- event DidReceiveAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS, byref AuthChallengeDisposition as Integer, byref credentials as NSURLCredentialMBS)
- event didReceiveScriptMessage(Body as Variant, name as String)
- event didReceiveServerRedirectForProvisionalNavigation(navigation as WKNavigationMBS)
- event didStartProvisionalNavigation(navigation as WKNavigationMBS)
- event downloadDecideDestinationUsingResponse(download as WKDownloadMBS, response as NSURLResponseMBS, suggestedFilename as String, byref destination as FolderItem)
- event downloadDidFailWithError(download as WKDownloadMBS, error as NSErrorMBS, resumeData as MemoryBlock)
- event downloadDidFinish(download as WKDownloadMBS)
- event downloadDidReceiveAuthenticationChallenge(download as WKDownloadMBS, challenge as NSURLAuthenticationChallengeMBS, byref AuthChallengeDisposition as Integer, byref credentials as NSURLCredentialMBS)
- event downloadWillPerformHTTPRedirection(download as WKDownloadMBS, response as NSURLResponseMBS, request as NSURLRequestMBS, byref DownloadRedirectPolicy as Integer)
- event EnableMenuItems
- event EstimatedProgressChanged(estimatedProgress as double, oldEstimatedProgress as double)
- event FocusLost
- event FocusReceived
- event FrameChanged
- event GotFocus
- event JavaScriptEvaluated(JavaScript as String, Result as Variant, Error as NSErrorMBS, Tag as String)
- event LostFocus
- event MenuBarSelected
- event MouseDown(x as Integer, y as Integer, Modifiers as Integer) As Boolean
- event MouseDrag(x as Integer, y as Integer)
- event MouseUp(x as Integer, y as Integer)
- event navigationActionDidBecomeDownload(navigationAction as WKNavigationActionMBS, download as WKDownloadMBS)
- event navigationResponseDidBecomeDownload(navigationResponse as WKNavigationResponseMBS, download as WKDownloadMBS)
- event Open
- event Opening
- event runJavaScriptAlertPanel(initiatedByFrame as WKFrameInfoMBS, message as String)
- event runJavaScriptConfirmPanel(initiatedByFrame as WKFrameInfoMBS, message as String) as boolean
- event runJavaScriptTextInputPanel(initiatedByFrame as WKFrameInfoMBS, prompt as String, defaultText as String) as String
- event runOpenPanelWithParameters(initiatedByFrame as WKFrameInfoMBS, allowsMultipleSelection as Boolean, allowsDirectories as Boolean)
- event ScaleFactorChanged(NewFactor as Double)
- event takeSnapshotCompleted(image as NSImageMBS, error as NSErrorMBS, tag as string)
- event TitleChanged(Title as String, oldTitle as string)
- event WebContentProcessDidTerminate
- event willShowContextualMenu(menu as NSMenuMBS, NSEvent as NSEventMBS)
- 27 properties
- property AcceptTabs as Boolean
- property allowFileAccessFromFileURLs as Boolean
- property allowsBackForwardNavigationGestures as Boolean
- property allowsLinkPreview as Boolean
- property allowsMagnification as Boolean
- property allowUniversalAccessFromFileURLs as Boolean
- property backForwardList as WKBackForwardListMBS
- property CanGoBack as Boolean
- property CanGoForward as Boolean
- property customUserAgent as String
- property developerExtrasEnabled as Boolean
- property EstimatedProgress as Double
- property hasOnlySecureContent as Boolean
- property IsLoading as Boolean
- property javaEnabled as Boolean
- property javaScriptCanOpenWindowsAutomatically as Boolean
- property javaScriptEnabled as Boolean
- property loadsImagesAutomatically as Boolean
- property magnification as Double
- property minimumFontSize as Double
- property Navigation as WKNavigationMBS
- property plugInsEnabled as Boolean
- property privateBrowsing as Boolean
- property Title as String
- property URL as String
- property View as NSViewMBS
- property WKWebView as WKWebViewMBS
- shared property UsePrivateBrowsing as Boolean
- 23 methods
- method addScriptMessageHandler(Name as String)
- method addUserScript(userScript as WKUserScriptMBS)
- method EvaluateJavaScript(JavaScript as String, byref Error as NSErrorMBS) as Variant
- method EvaluateJavaScript(JavaScript as String, Tag as String = "")
- method goBack
- method goForward
- method goToBackForwardListItem(Item as WKBackForwardListItemMBS)
- method LoadData(Data as MemoryBlock, MIMEType as String, textEncodingName as String, baseURL as string = "")
- method LoadFileURL(File as FolderItem, readAccessItem as FolderItem)
- method LoadHTML(htmlText as String, baseURL as string = "")
- method LoadURL(URL as string)
- method LoadURLRequest(Request as NSURLRequestMBS)
- method printOperation(printInfo as NSPrintInfoMBS) as NSPrintOperationMBS
- method reload
- method reloadFromOrigin
- method removeAllUserScripts
- method removeScriptMessageHandler(Name as String)
- method runOpenPanelWithParametersCompleted(URLs() as NSURLMBS)
- method setMagnification(magnification as double, pointX as double, pointY as double)
- method stopLoading
- method takeSnapshot(byref error as NSErrorMBS) as NSImageMBS
- method takeSnapshot(tag as string = "")
- method userScripts as WKUserScriptMBS()
- shared method setUsePrivateBrowsing(value as Boolean)
- 6 constants
Authentication Challenge Responses
Constant | Value | Description |
---|---|---|
AuthChallengeCancelAuthenticationChallenge | 2 |
Cancel the entire request. The provided credential parameter is ignored. |
AuthChallengePerformDefaultHandling | 1 |
Use the default handling for the challenge as though this delegate method were not implemented. The provided credential parameter is ignored. |
AuthChallengeRejectProtectionSpace | 3 |
Reject this challenge, and call the authentication delegate method again with the next authentication protection space. The provided credential parameter is ignored. |
AuthChallengeUseCredential | 0 |
Use the specified credential, which may be nil. |
Redirect Policy
Constant | Value | Description |
---|---|---|
DownloadRedirectPolicyAllow | 1 |
Allow a redirect to proceed. |
DownloadRedirectPolicyCancel | 0 |
Cancel the redirect action. |
Some examples using this control:
Blog Entries
- MonkeyBread Software Releases the MBS Xojo Plugins in version 22.0
- News from the MBS Xojo Plugins in version 21.5
- New desktop controls
- Three new controls for iOS in Xojo
- HTMLViewer JavaScript communication for Xojo
- MBS Xojo Plugins in version 19.0
- HTMLViewer JavaScript communication for Xojo
- Custom JavaScript messages to WKWebViewControlMBS
- Enable Web Inspector for WebViewer
- MonkeyBread Software Releases the MBS Xojo plug-ins in version 17.0
Xojo Developer Magazine
- 18.3, page 43: Happy Birthday MonkeyBread Software, What is new in the MBS Xojo Plugins by Stefanie Juchmes
- 17.5, page 41: What's New in the MBS Plugins, With the Plugins growing every year, here are new capabilities you may have missed by Stefanie Juchmes
- 17.2, page 10: News
- 16.2, page 9: News
- 15.2, page 10: News
Videos
- XDC 2020 MBS Plugins Presentation
- Presentation from Munich conference about MBS Plugins.
- Presentation from London conference about MBS Plugins.
- Presentation from Xojo Developer Conference 2019 in Miami.
The items on this page are in the following plugins: MBS Mac64bit Plugin.
WinPreviewControlMBS - WKWebViewIOSControlMBS
