[Solved] WebGadget: How to get PageTitle with #PB_Web_Edge flag?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Techmas
User
User
Posts: 11
Joined: Sun Jan 26, 2020 2:06 pm

[Solved] WebGadget: How to get PageTitle with #PB_Web_Edge flag?

Post by Techmas »

Hi, I encountered the following issue concerning WebGadget:

It seems that the PageTitle can only be fetched, if the #PB_Web_Edge flag is not set. How can i get it to work with #PB_Web_Edge?
I am grateful for suggestions!

Code: Select all

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
	WebGadget(0, 0, 0, 600, 300, "https://duckduckgo.com/", #PB_Web_Edge)
	
	While GetGadgetAttribute(0, #PB_Web_Busy)<>0
		WindowEvent()
	Wend
	
	Debug GetGadgetItemText(0, #PB_Web_PageTitle)

	Repeat 
	Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf
Last edited by Techmas on Mon Nov 18, 2024 9:11 pm, edited 1 time in total.
User avatar
Techmas
User
User
Posts: 11
Joined: Sun Jan 26, 2020 2:06 pm

WebGadget: How to get PageTitle with #PB_Web_Edge flag?

Post by Techmas »

Thanks to mve001 the problem could be solved by adding a loop to wait until the website's title has changed instead of #PB_Web_Busy returns 0. It seems that #PB_Web_Busy may return 0 before the page is fully loaded.

Code: Select all

If OpenWindow(0, 0, 0, 600, 300, "WebGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
	WebGadget(0, 0, 0, 600, 300, "https://duckduckgo.com/", #PB_Web_Edge)

	While Len(GetGadgetItemText(0, #PB_Web_PageTitle)) = 0
	    WindowEvent()
	Wend

	Debug GetGadgetItemText(0, #PB_Web_PageTitle)

	Repeat 
	Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf
Bug report
Post Reply