I found out that the web gadget on Linux is not as complete as its Windows counterpart. I did find this thread with a couple of improvements but nothing for #PB_Web_Busy.
Has anyone found a workaround for this?
Has anyone found a workaround for #PB_Web_Busy on Linux?
Re: Has anyone found a workaround for #PB_Web_Busy on Linux?
If you want to use #PB_Web_Busy to detect when a download has ended by polling for #False, I don't advise this method because I have already made the experience that on some websites #PB_Web_Busy changes sometimes to #False and shortly afterwards back to #True because some components still need loading and therefore the download is still not completed. The best method on WebGadgets using WebKit should be to evaluate the signal "document-load-finished" (tested successfully on Linux Mint 19.3 x64 'Tricia' with Cinnamon using PB 5.73 x64):
If you want to find out the current status when loading a website, you may try the following example:
Code: Select all
URL.S = "http://www.google.com"
ProcedureC DocumentLoadCompleted(WebView.I, WebFrame.I, UserData.I)
MessageRequester("Info", "Loading of web page has completed!")
EndProcedure
WindowID = OpenWindow(#PB_Any, 0, 0, 1000, 800,
"Detect completion of loading web page",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 5, 5, WindowWidth(WindowID) - 10, WindowHeight(WindowID) - 10, URL)
g_signal_connect_(GadgetID(0), "document-load-finished",
@DocumentLoadCompleted(), 0)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Code: Select all
Enumeration WebKitLoadStatus
#WEBKIT_LOAD_PROVISIONAL
#WEBKIT_LOAD_COMMITTED
#WEBKIT_LOAD_FINISHED
#WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT
#WEBKIT_LOAD_FAILED
EndEnumeration
ImportC "-lwebkitgtk-3.0"
webkit_web_view_get_load_status(*WebView)
EndImport
URL.S = "https://www.google.de"
WindowID = OpenWindow(#PB_Any, 100, 100, 1000, 800,
"Display status of loading web page",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 5, 5, WindowWidth(WindowID) - 10, WindowHeight(WindowID) - 10, URL)
Repeat
WindowEvent = WaitWindowEvent()
If WebPageLoadCompleted = #False
Select webkit_web_view_get_load_status(GadgetID(0))
Case #WEBKIT_LOAD_PROVISIONAL
Debug "No data received yet, empty structures have been allocated"
Case #WEBKIT_LOAD_COMMITTED
Debug "First data chunk has arrived"
Case #WEBKIT_LOAD_FINISHED
WebPageLoadCompleted = #True
Debug "Loading of web page has completed"
Case #WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT
Debug "First layout with visual content has started"
Case #WEBKIT_LOAD_FAILED
WebPageLoadCompleted = #True
Debug "Loading of web page has failed"
Break
EndSelect
EndIf
Until WindowEvent = #PB_Event_CloseWindow
Re: Has anyone found a workaround for #PB_Web_Busy on Linux?
Thank you for this. I'm unfamiliar with this library and "document-load-finished" works as expected. You're right that the page can do other things that will cause the value to flip. But what is it?
Is it JavaScript? Websites are telling me that it's not enabled; tested on Debian 9.x and CentOS 7.x but I can confirm that content can continue to load.
Tested on https://www.whatismybrowser.com/detect/ ... pt-enabled
I'm also having problems if the site I try to visit has Cloudflare.
Is it JavaScript? Websites are telling me that it's not enabled; tested on Debian 9.x and CentOS 7.x but I can confirm that content can continue to load.
Tested on https://www.whatismybrowser.com/detect/ ... pt-enabled
I'm also having problems if the site I try to visit has Cloudflare.