Skip to content

Commit a3e8490

Browse files
authored
v2.1.0-alpha
1 parent c848849 commit a3e8490

1 file changed

Lines changed: 47 additions & 32 deletions

File tree

README.md

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ A powerful bridge that allows **AutoIt** to use the modern **Microsoft Edge WebV
66
https://www.autoitscript.com/forum/topic/213375-webview2autoit-autoit-webview2-component-com-interop
77

88
---
9-
109
### 🚀 Key Features
1110

1211
* **Chromium Engine**: Leverage the speed and security of modern Microsoft Edge.
@@ -55,7 +54,6 @@ https://www.autoitscript.com/forum/topic/213375-webview2autoit-autoit-webview2-c
5554

5655

5756
---
58-
5957
### ⚖️ License
6058

6159
This project is provided "as-is". You are free to use, modify, and distribute it for both personal and commercial projects.
@@ -64,7 +62,6 @@ This project is provided "as-is". You are free to use, modify, and distribute it
6462
<p align="center">
6563
<img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" width="100%">
6664
</p>
67-
6865
## 🚀 What's New in v2.1.0-alpha - Frame Support & Event Isolation
6966

7067
This patch introduces first-class support for `iframe` interaction, allowing developers to target specific frames for script execution, messaging, and host object binding.
@@ -357,6 +354,14 @@ Returns a pipe-separated string of all tracked iframe names.
357354
Asynchronously retrieves the HTML of the frame at the specified index (sent via OnMessageReceived with 'FRAME_HTML_SOURCE|Index|').
358355
`object.GetFrameHtmlSource(Index As Integer)`
359356

357+
##### ⚡ GetFrame
358+
Returns a `WebView2Frame` COM object for the frame at the specified index. Returns `Null` if the index is invalid.
359+
`object.GetFrame(Index As Integer)`
360+
361+
##### ⚡ GetFrameById
362+
Returns a `WebView2Frame` COM object for the frame matching the specified FrameId. Returns `Null` if not found.
363+
`object.GetFrameById(FrameId As UInt)`
364+
360365
##### ⚡ GetSelectedText
361366
Asynchronously retrieves the currently selected text (sent via OnMessageReceived with 'SELECTED_TEXT|').
362367
`object.GetSelectedText()`
@@ -661,98 +666,108 @@ Fired when the browser requires basic authentication credentials for a URI.
661666
Complete(): Notifies the browser that credentials have been set (supports asynchronous data gathering).*
662667

663668

669+
##### 🔔 OnPermissionRequested
670+
Fired when the page requests a permission (e.g. Geolocation, Camera, Microphone).
671+
`object_OnPermissionRequested(Sender As Object, ParentHandle As String, Args As Object)`
672+
*Args properties:
673+
Handled (bool): Set to True to indicate the event is handled.
674+
IsUserInitiated (bool): Whether the request was triggered by user interaction.
675+
PermissionKind (int): The type of permission requested.
676+
State (int): Get/Set the permission state (0=Default, 1=Allow, 2=Deny).
677+
Uri (string): The URI of the page requesting the permission.
678+
*Args methods:
679+
GetDeferral(): Acquires an async deferral for out-of-band decision making.
680+
Complete(): Completes the deferral and notifies the browser of the decision.*
681+
664682
#### ===🔔Frame Events===
665683

666684
##### 🔔 OnFrameCreated
667685
Fired when a new iframe is created in the document.
668-
`object_OnFrameCreated(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame)`
686+
`object_OnFrameCreated(Sender As Object, ParentHandle As String, Frame As Object)`
669687

670688
##### 🔔 OnFrameDestroyed
671689
Fired when an iframe is removed from the document.
672-
`object_OnFrameDestroyed(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame)`
690+
`object_OnFrameDestroyed(Sender As Object, ParentHandle As String, Frame As Object)`
673691

674692
##### 🔔 OnFrameNameChanged
675693
Fired when an iframe's name attribute changes.
676-
`object_OnFrameNameChanged(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame)`
694+
`object_OnFrameNameChanged(Sender As Object, ParentHandle As String, Frame As Object)`
677695

678696
##### 🔔 OnFrameNavigationStarting
679697
Fired when a frame starts navigating to a new URL.
680-
`object_OnFrameNavigationStarting(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, Url As String)`
698+
`object_OnFrameNavigationStarting(Sender As Object, ParentHandle As String, Frame As Object, Url As String)`
681699

682700
##### 🔔 OnFrameNavigationCompleted
683701
Fired when a frame navigation has finished.
684-
`object_OnFrameNavigationCompleted(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, IsSuccess As Boolean, WebErrorStatus As Integer)`
702+
`object_OnFrameNavigationCompleted(Sender As Object, ParentHandle As String, Frame As Object, IsSuccess As Boolean, WebErrorStatus As Integer)`
685703

686704
##### 🔔 OnFrameContentLoading
687705
Fired when a frame starts loading content.
688-
`object_OnFrameContentLoading(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, NavigationId As Long)`
706+
`object_OnFrameContentLoading(Sender As Object, ParentHandle As String, Frame As Object, NavigationId As Long)`
689707

690708
##### 🔔 OnFrameDOMContentLoaded
691709
Fired when a frame's DOM content is fully loaded.
692-
`object_OnFrameDOMContentLoaded(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, NavigationId As Long)`
710+
`object_OnFrameDOMContentLoaded(Sender As Object, ParentHandle As String, Frame As Object, NavigationId As Long)`
693711

694712
##### 🔔 OnFrameWebMessageReceived
695713
Fired when a frame receives a message via `window.chrome.webview.postMessage`.
696-
`object_OnFrameWebMessageReceived(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, Message As String)`
697-
698-
##### 🔔 OnFrameProcessFailed 🚧
699-
Fired when a frame renderer or other process fails.
700-
`object_OnFrameProcessFailed(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, Args As Object)`
714+
`object_OnFrameWebMessageReceived(Sender As Object, ParentHandle As String, Frame As Object, Message As String)`
701715

702716
##### 🔔 OnFramePermissionRequested
703717
Fired when a frame requests permission (e.g. Geolocation).
704-
`object_OnFramePermissionRequested(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, Args As Object)`
705-
706-
##### 🔔 OnFrameScreenCaptureStarting
707-
Fired when a frame starts a screen capture session.
708-
`object_OnFrameScreenCaptureStarting(Sender As Object, ParentHandle As HWND, Frame As IWebView2Frame, Args As Object)`
718+
`object_OnFramePermissionRequested(Sender As Object, ParentHandle As String, Frame As Object, Args As Object)`
719+
*See `OnPermissionRequested` Args for property details.*
709720

710721

711722
---
712723
### 🧊 WebView2Frame (ProgId: NetWebView2Lib.WebView2Frame)
713724

714725
#### ===🏷️Properties===
715726

716-
##### 🏷️Name
727+
##### 🏷️ Name
717728
Returns the name attribute of the frame.
718729
`string object.Name`
719730

720731
##### 🏷️ IsDestroyed
721732
Checks if the frame is still valid and attached to the page.
722-
`bool object.IsDestroyed()`
733+
`bool object.IsDestroyed`
734+
735+
##### 🏷️ FrameId
736+
Returns the unique identifier of the frame (assigned by the browser).
737+
`uint object.FrameId`
738+
739+
##### 🏷️ Source
740+
Returns the current URL of the frame. Uses reflection-based SDK-independent retrieval.
741+
`string object.Source`
723742

724743
#### ===⚡Methods===
725744

726-
##### ⚡ExecuteScript (DispId 2)
745+
##### ⚡ExecuteScript
727746
**Type**: void (Fire-and-Forget)
728747
**Description**: Executes JavaScript within the context of the frame.
729748
`object.ExecuteScript(Script As String)`
730749

731-
##### ⚡ExecuteScriptWithResult (DispId 6)
750+
##### ⚡ExecuteScriptWithResult
732751
**Type**: string (Synchronous/Blocking)
733752
**Description**: Executes JavaScript in the frame and waits for the result (Thread-Safe).
734753
`object.ExecuteScriptWithResult(Script As String)`
735754

736-
##### ⚡PostWebMessageAsJson (DispId 3)
755+
##### ⚡PostWebMessageAsJson
737756
Sends a JSON message to the frame content.
738757
`object.PostWebMessageAsJson(Json As String)`
739758

740-
##### ⚡PostWebMessageAsString (DispId 4)
759+
##### ⚡PostWebMessageAsString
741760
Sends a plain text message to the frame content.
742761
`object.PostWebMessageAsString(Text As String)`
743762

744-
##### ⚡AddHostObjectToScript (DispId 7)
763+
##### ⚡AddHostObjectToScript
745764
Adds a host object (AutoIt object) to the frame's script environment.
746765
`object.AddHostObjectToScript(Name As String, RawObject As Object)`
747766

748-
##### ⚡RemoveHostObjectFromScript (DispId 8)
767+
##### ⚡RemoveHostObjectFromScript
749768
Removes a host object from the frame's script environment.
750769
`object.RemoveHostObjectFromScript(Name As String)`
751770

752-
##### ⚡IsDestroyed (DispId 5)
753-
Checks if the frame is valid.
754-
`bool object.IsDestroyed()`
755-
756771
---
757772

758773
### 🧊 WebView2Parser (ProgId: NetWebView2Lib.WebView2Parser)

0 commit comments

Comments
 (0)