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

Just starting out? Need help? Post your questions and find answers here.
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

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

Post 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?
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

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

Post 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.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

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

Post 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.
User avatar
the.weavster
Addict
Addict
Posts: 1537
Joined: Thu Jul 03, 2003 6:53 pm
Location: England

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

Post by the.weavster »

Thanks, Kukulkan :D
Post Reply