Platforms to show: All Mac Windows Linux Cross-Platform
Back to WKWebViewMBS class.
WKWebViewMBS.addUserScript(userScript as WKUserScriptMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
On success the handle property is not zero.
See also:
WKWebViewMBS.Constructor(Handle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The handle is casted to a WKWebView and the plugin retains this handle.
See also:
WKWebViewMBS.Constructor(left as double, top as double, width as double, height as double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
On success the handle property is not zero.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
WKWebViewMBS.EvaluateJavaScript(JavaScript as String, byref Error as NSErrorMBS) as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Synchronous version which waits for JavaScript to return the value.
Error is set in case of errors.
Result is converted from JavaScript data types to Xojo datatypes, usually variants, dictionaries or array of variants.
WKWebViewMBS.getMediaPlaybackState as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 24.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
See MediaPlaybackState* constants.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.goToBackForwardListItem(Item as WKBackForwardListItemMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
item: The item to which to navigate. Must be one of the items in the web view's back-forward list.
WKWebViewMBS.HTMLText as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This is live, so any changes made after loading will be included.
WKWebViewMBS.LoadData(Data as MemoryBlock, MIMEType as String, textEncodingName as String, baseURL as string = "")
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
data: The data to use as the contents of the webpage.
MIMEType: The MIME type of the data.
characterEncodingName: The data's character encoding name.
baseURL: A URL used to resolve relative URLs within the document.
WKWebViewMBS.LoadFileURL(File as FolderItem, readAccessItem as FolderItem)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Navigates to the requested file URL on the filesystem.
file: The file URL to which to navigate.
readAccessItem: The file or folder to allow read access to.
If readAccessItem references a single file, only that file may be loaded by WebKit.
If readAccessItem references a directory, files inside that file may be loaded by WebKit.
WKWebViewMBS.LoadHTML(htmlText as String, baseURL as string = "")
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
htmlText: The string to use as the contents of the webpage.
baseURL: A URL used to resolve relative URLs within the document.
WKWebViewMBS.LoadURL(URL as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.LoadURLRequest(Request as NSURLRequestMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.MainResourceData(byref error as NSErrorMBS) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Returns nil in case of error.
Also sets error parameter to NSErrorMBS for details on the error.
Some examples using this method:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
WKWebViewMBS.pauseAllMediaPlayback
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 24.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
WKWebViewMBS.PDFData(byref error as NSErrorMBS) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Returns PDF data of new PDF Document.
If the data is written to a file the resulting file is a valid PDF document.
Available in macOS 11.0 or newer.
May also work if Safari 14 is installed on older macOS versions.
Some examples using this method:
WKWebViewMBS.PlainText as String
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This is live, so any changes made after loading will be included.
WKWebViewMBS.printOperation(printInfo as NSPrintInfoMBS) as NSPrintOperationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Works for WebKit 1.x and 2.x.
For WebKit 2.x may run into endless loop for some websites due to bugs in Apple's WebKit framework.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.removeAllUserScripts
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
WKWebViewMBS.setMagnification(magnification as double, pointX as double, pointY as double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
magnification: The factor by which to scale the content.
x/y: The point (in view space) to center magnification on. As usual with Cocoa, bottom is y = 0.
For MacOS 64-bit only.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.takeSnapshot(byref error as NSErrorMBS) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This is synchronous version which waits for image to be finished.
In case of error the result is nil and error may be set.
WKWebViewMBS.userScripts as WKUserScriptMBS()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
WKWebViewMBS.WebArchiveData(byref error as NSErrorMBS) as MemoryBlock
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | WebKit2 | MBS Mac64bit Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
May return nil in case of error and maybe report the NSError in case of an error.
The items on this page are in the following plugins: MBS Mac64bit Plugin.
