MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Would it be possible to add Native Event Handlers

Open
#279 9 comments 3 reactions 2 assignees View on GitHub

@KomalPrasadMSPM is already working on this.

Since Mar 5, 2025.

feature request priority-low tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

At the request of @liminzhu on issue #253 I'm opening this as a new issue so it can be more easily tracked.

Following the recent discussion on the issue mentioned above, a number of users (Myself included) have come to the conclusion that adding a native pass through to the C# side of things for common JavaScript events would be a good idea.

Primarily the request was asked about passing through either the "DOMContentReady" or "load" event handlers so that there was a notification on the C# side when either of these 2 JavaScript events where raised.

As the discussion progressed however, it became apparent that a universal event system would be more beneficial.

There are some common events such as the load events, and possibly click, blur and focus events that should have ready made interception points, but in general something like a 'RaiseEvent("eventName", new { ... event data ... })' in C#, along with a corresponding "onEventRaised(sender, string eventName, new { ... event data ...})" would help with linking up C# code to JS code.

In my Custom browser (https://github.com/shawty/hbbtvbrowserEXPERIMENTAL) I've more or less done that myself using the existing message passing features, so I don't think it would be too difficult for a permanent JavaScript stub to be added to the existing code in the control that performed a similar task and surfaced these events in an easier to digest way.

AB#27010334

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.