question

ApostolosDoudakmanis-1991 avatar image
0 Votes"
ApostolosDoudakmanis-1991 asked ApostolosDoudakmanis-1991 commented

How can I read hyperlinks while the page is loading in WebView2 VB.NET

I am building a tabbed browser with WebView2

How can I read the hyperlinks in StatusText while the page is loading in WebView2 so I can tell if they are hyperlinks, videos, photos and programs?

dotnet-visual-basic
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ApostolosDoudakmanis-1991 ,
What do you mean "the hyperlinks in StatusText“?
StatusText contains the status message corresponding to the HTTP status code.




0 Votes 0 ·
ApostolosDoudakmanis-1991 avatar image
0 Votes"
ApostolosDoudakmanis-1991 answered ApostolosDoudakmanis-1991 edited

from this image that appears the arrow shows the address it loads ...
212657-webview2.png



and in NavigateStarting I want to check this address so I can edit it

 Private Sub brws_NavigationStarting(sender As Object, e As CoreWebView2NavigationStartingEventArgs) Handles brws.NavigationStarting
        
     TabControl1.SelectTab(TabControl1.TabCount - 1)

     StatusText.Text = "Loading ... " & e.Uri.ToString

     If PressedStopButton = True Then
         e.Cancel = True
         StatusText.Text = "Cancel loading ... "
         PressedStopButton = False
         Exit Sub
     End If

    If InStr(1, e.Uri.ToString, "ads", vbTextCompare) Then
         Cancel = True
     Else
         Cancel = False
     End If

 End Sub

Also when I move the mouse over a post title or image it shows me the address in StatusText


webview2.png (3.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered ApostolosDoudakmanis-1991 commented

Hi @ApostolosDoudakmanis-1991 ,
Please check the following documentations to see if they are helpful to you.
CoreWebView2.StatusBarText Property
CoreWebView2.StatusBarTextChanged Event
Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

documentations without examples


0 Votes 0 ·
Castorix31 avatar image
0 Votes"
Castorix31 answered ApostolosDoudakmanis-1991 commented

I only get StatusBar text when I move the mouse on links/images/...

Parts of code (cannot post here...) : WebView21_StatusBarTextChanged


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31
your example is for a form with the a webview2

my project is a Tabbed browser with TabControl and TabPages. Every TabPage inlcude a WebView and a UserContro named AddresBar (include textbox for web address and the buttons for Back Page, Next Page, Refresh, Stop and Home
it's different

214415-tabbed-webview2.jpg



here i have the problem

0 Votes 0 ·
tabbed-webview2.jpg (176.0 KiB)