[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WebView object - Event on Link click


I just tested that and it works better with the MouseUp event not Mousedown

This simple code seems to work, the non https:// links do nothing if i
select Ignore..
If the event Returns it works as normal or it hits the Stop Event call and
cancels the click.

Public Sub WebView1_MouseUp()

  If WebView1.Link Begins "https://"; Then Return
  If Message.Question("Warning! non secure link\n\n" & WebView1.Link,
"Goto", "Ignore") = 1 Then Return

  Stop Event

End

Respects
BruceS

On Wed, 9 Sept 2026 at 08:34, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

> Could you use the MouseDown or MouseUp event with the Webview.Link
> property ?
>
> Public Sub WebView1_MouseDown()
>
>   If Webview1.Link = "MyCustomLink" Then
>    DoSomethingWithLink()
>    Stop Event   ' Don't do anything else with the link
>   Endif
>
> End
>
> Respects
> BruceS
>
> On Wed, 9 Sept 2026 at 04:39, Olivier Cruilles <olivier.cruilles@xxxxxxxx>
> wrote:
>
>> Hello,
>>
>> I'm using a WebView (gb.qt) in one of my project and I would like to
>> know if it's possible to raise an event when the user click on a Web
>> Link in the web page displayed into this WebView.
>>
>> I tried the WebView1_Link() event but it raise when the user fly over a
>> link with the mouse, but no way to get the link reference.
>>
>> My goal will to get a fake link in the web page displayed into the
>> WebView object, when the user click on it with the mouse.
>>
>> I don't want to be redirected to the end point of the link, I just would
>> like to get the Link reference, for internal process using it.
>>
>>
>> Does anyone has already experienced that and can help me on that please ?
>>
>>
>> Thank you
>>
>> Olivier
>>
>>
>>

References:
WebView object - Event on Link clickOlivier Cruilles <olivier.cruilles@xxxxxxxx>
Re: WebView object - Event on Link clickBruce Steers <bsteers4@xxxxxxxxx>