Home
Products
Community
Manuals
Contact
Login or Signup

BlitzPlus Docs -> HtmlViewEventURL

HtmlViewEventURL$(html)

Parameters:

htmlview - A htmlview gadget handle

Description:

Returns the event URL of a htmlview gadget.

The event URL is the URL of the last link that was clicked when a htmlview's style is set to 2 (NONAVIGATE). This allows you to then detect what link has been clicked.

See also: CreateHTMLView, HTMLViewGo, HTMLViewBack, HTMLViewForward, HtmlViewCurrentURL, HtmlViewStatus, HtmlViewRun.

Example:

; A Basic Blitz Web Browser!
win=CreateWindow("Basic Blitz Web Browser",100,100,500,500,0,35)

; Create htmlview gadget - for HTMLViewEventURL to return a string, we need to set style to 2 (NONAVIGATE)
html = CreateHtmlView(0,0,500,480,win,2)

; Ensure the HTML view will stretch to meet the size of the window when it is resized
SetGadgetLayout html,1,1,1,1

; Go to URL
HtmlViewGo html,"http:\\www.blitzbasic.com"

; Create label gadget that will display event url
label=CreateLabel("",0,480,500,20,win,3)

; Ensure that the label stays at the bottom of the window
SetGadgetLayout label,1,1,0,1


Repeat

	id = WaitEvent()
	If id=$803 Then Exit

	; If gadget event occurs...
	If id=$401 And EventSource()=html
		url$=HtmlViewEventURL$(html)
		Select EventData()
			Case 0	;page load event
				; Set label's text to that of the htmlview event url
				SetGadgetText label,"loaded "+url$
			Case 1	;user navigate event
				SetGadgetText label,"navigating to "+url$
				HtmlViewGo html,url$
		End Select
	EndIf

Forever 

Comments

simonh(Posted 1+ years ago)
This command was introduced in V1.39.


skidracer(Posted 1+ years ago)
Revised example to demonstrate both the page loaded event and the user navigate event. The user navigate event handler can be used to either disable or filter user navigation as well as receive messages from page scripts.


BlitzPlus Manual Forum

Blitz3D Equivalent Command