Page 1 of 1

How to disable JS in WebGadget on Windows?

Posted: Wed Nov 14, 2018 12:17 pm
by Kukulkan
Hi,

I need to disable JS in WebGadget and found solutions for MacOS and Linux. But how to disable on Windows? I need to do this because even IE11 does not respect Content Security Policy (CSP) meta tags and some sandboxed iframe does not work for me (no navigation callbacks then).

Any code about how to change WebGadget settings on Windows?

Re: How to disable JS in WebGadget on Windows?

Posted: Wed Nov 14, 2018 5:44 pm
by Kukulkan
Okay, maybe it is helpful if I tell you what I found yet:

This page from Microsoft is saying, that DLCTL_NO_SCRIPTS is able to stop any JS execution.

I already found, how to get the IWebBrowser2 interface from the WebGadget:

Code: Select all

Protected Browser.IWebBrowser2 = GetWindowLong_(GadgetID(WebgadgetID.i), #GWL_USERDATA)
But this is where it stops. I have no clue about, how to set this property/setting to the existing IWebBrowser2 object. Also, it sounds like this has to be done directly during instantiation. But, if using a WebGadget, this is already done. Not sure if this also works at a later stage (eg before loading content using SetGadgetText())?

Any hints on this?

Re: How to disable JS in WebGadget on Windows?

Posted: Wed Nov 14, 2018 9:01 pm
by normeus
the following code thanks to @hm
works on windows 7 x64 with pb 5.63 x86
viewtopic.php?p=285244#p285244


Norm.

Re: How to disable JS in WebGadget on Windows?

Posted: Thu Nov 15, 2018 8:41 am
by Kukulkan
Thanks normeus!

The code of hm and justin (update) seem to do the job, but this is a workaround that scares me. In my experience, the bigger the hack the more likely it will fail for some users.

Isn't there any shorter solution?