How to disable JS in WebGadget on Windows?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

How to disable JS in WebGadget on Windows?

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

Re: How to disable JS in WebGadget on Windows?

Post 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?
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: How to disable JS in WebGadget on Windows?

Post by normeus »

the following code thanks to @hm
works on windows 7 x64 with pb 5.63 x86
viewtopic.php?p=285244#p285244


Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: How to disable JS in WebGadget on Windows?

Post 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?
Post Reply