Page 1 of 1

WebGadget() on Linux doesn't request *.js files?

Posted: Fri May 19, 2017 9:41 am
by the.weavster
I've got a very simple window that contains a fullscreen WebGadget() and nothing more, it is connecting to a web server I've written in PB. The page being displayed in the WebGadget() doesn't function properly and I can see from the requests it's sending to my server it never actually retrieves the *.js files! The same code is working fine on Windows.

Any ideas what I'm doing wrong?

Re: WebGadget() on Linux doesn't request *.js files?

Posted: Fri May 19, 2017 10:57 am
by the.weavster
This problem is consistent on Ubuntu and Mint and whether I load the page using the server or the file protocol, the WebGadget() just does not request the *.js files.

Re: WebGadget() on Linux doesn't request *.js files?

Posted: Fri May 19, 2017 1:58 pm
by Kukulkan
I remember that JS is not enabled by default on the Linux WebGadget. I took a look into my code and found the following (I believe it is an extract of some answers here in the forum):

Code: Select all

CompilerIf #PB_Compiler_Version > 540  
    ImportC "-lwebkitgtk-3.0"
CompilerElse
    ImportC "-lwebkitgtk-1.0"
CompilerEndIf    
    webkit_web_settings_new()
    webkit_web_view_set_settings(*WebkitWebView, *WebkitSettings)
EndImport
  
Procedure EnableJSforWebGadget(WebgadgetID.i)
    ; Enable JavaScript support in GTK3 WebGadgets
    Protected WebkitSettings.i
    ; ----- Get Webkit's default setting (with scripting languages enabled by default)
    WebkitSettings = webkit_web_settings_new()
    ; ----- Store Webkit's default settings in WebGadget
    webkit_web_view_set_settings(GadgetID(WebgadgetID.i), WebkitSettings)
EndProcedure
This works fine for me. I hope it works for you, too.

Re: WebGadget() on Linux doesn't request *.js files?

Posted: Fri May 19, 2017 3:27 pm
by the.weavster
Thanks, Kukulkan :D