Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

I have an item that hosts a web page. How can I cancel the navigation if the user clicks a link?

0
Posted

I have an item that hosts a web page. How can I cancel the navigation if the user clicks a link?

0

If you are loading a HTML page to an item using InsertControlItem method, the control creates a “Microsoft Web Browser Control”. The “Microsoft Web Browser Control” provides the BeforeNavigate2 event that’s fired just before navigation occurs. The following sample cancels any navigation whether the user clicks a link in the page: Private Sub Form_Load() With Tree1.Items .InsertControlItem , App.Path + “\stub.htm” End With End Sub Private Sub Tree1_ItemOleEvent(ByVal Item As EXTREELibCtl.HITEM, ByVal Ev As EXTREELibCtl.IOleEvent) If (“BeforeNavigate2” = Ev.Name) Then Ev(“Cancel”).Value = True End If End Sub The sample assumes that you have already a column inserted. You can use the control’s Template property page to add a default column before running the code.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123