MicrosoftEdge / MicrosoftEdge/WebView2Feedback
Trap anchor tags
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
Using CoreWebview2 to replace the IE ocx control, I have the need to trap when an anchor tag has been clicked on. I beleive in IE this was done using BeforeNavigate2 event but I do not see a direct replacement.
For example:
<a href='#Code123'>Run code 123 </a>
<a href='#Code124'>Run code 124 </a>
<a href='#Code125'>Run code 125 </a>
In this case these sections #Code123 doesn't exist in the html but where caught in the BeforeNavigate2 event handler and runs some other abitary code which is the requirement.
I thought similar could be done by using (Language C#):
webView.CoreWebView2.AddWebResourceRequestedFilter("*", CoreWebView2WebResourceContext.All);
webView.CoreWebView2.WebResourceRequested += CoreWebView2_WebResourceRequested;
But the event CoreWebView2_WebResourceRequested doesn't event get fired. It gets fired when there is a valid hyperlink or leaving out the #.
Their is no javascript or id's in these HTML files. These HTML files are already deployed to end users and are not easily replaced.
How do I resolve this. I'm currently using build 1.0.1072.54 or Microsoft.Web.WebVew2.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CoreWebView2 anchor-navigation scenario described in the issue and compare it with the existing WebResourceRequested event and filter setup. Verify the behavior against the supplied HTML examples and WebView2 build 1.0.1072.54; done means determining how clicks on the fragment-only anchors can be trapped without changing the deployed HTML.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100