NavigateToStringSync
Interface AntView
Type: Method
Parameters: String htmlContent Boolean *IsSuccess TxWebErrorStatus *WebErrorStatus
Returns: Integer
Navigate to a new document which is passed via parameter htmlContent as html.
The page cannot be larger than 2 MB in total size.
You can run javascript in the page in order to interact with it.
As the URL is "about:blank" there might be CORS restrictions if you try to interact with a frame that you load in your browser.
This will trigger the navigational events, starting with OnNavigationStarting and ending on OnNavigationCompleted. The latter one has the results on how well the navigation went.
Alternatively you can look at the - pass by reference - variables IsSuccess and WebErrorStatus.
IsSuccess is True when the document was correctly loaded, if IsSuccess returns false then you can inspect WebErrorStatus for the reason (see TxWebErrorStatus for details)
The function itself returns the following values:
0 if no errors.
21 function is already running (can only run one at a time)
22 function timed out
25 Trying to run a synchronous method from within a WebView2 event
If navigating the passed content takes more than 5 seconds, you might want to adjust the time out via SynchronousTimeOut to something else. As SynchronousTimeOut has a default for the AntView interface of 5 seconds.
This is the Synchronous alternative of the NavigateToString method.
As the function wraps the async bits, you cannot have the asynchronous variant running when you call this.
Beware that you cannot issue a synchronous call from within an AntView event, with the exception being the OnCreate event.
Introduced in AntView release 1.1.236
AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/25/2024