I have an item that hosts a web page. How can I cancel the navigation if the user clicks a link?
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
- If a customer clicks on my CD Baby or Amazon link on my Encore Store web page and makes a purchase, will The Encore Store get a cut out of my profit?
- When a user clicks a subfolder link in a folder portlet, the content area displays. How can I keep them on the portal page?
- I have an item that hosts a web page. How can I cancel the navigation if the user clicks a link?