Is it able to dynamically switch on/off javascript execution

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Is it able to dynamically switch on/off javascript execution

Postby jiaojiao » Wed Nov 30, 2016 9:57 am

Hi All,

I am curious of whether it is able to dynamically switch on/off javascript execution after the browser is created.

I know there is a cefbrowsersetting called l_cefbrowsersettings.javascript = STATE_DISABLED.

However, I would like to dynamically switch js execution on/off of a browser. Is it possible in CEF3?

Is there any enhancement related to this? I found https://code.google.com/archive/p/chrom ... /issues/53 which is marked as duplicated. Don't know which issue it is duplicated to.

Thanks,
jiaojiao
jiaojiao
Techie
 
Posts: 44
Joined: Thu Jun 11, 2015 3:24 am

Re: Is it able to dynamically switch on/off javascript execu

Postby digory » Wed Nov 30, 2016 10:20 am

According to http://magpcss.org/ceforum/viewtopic.php?f=6&t=13462, there is no way of turning JavaScript on/off dynamically. However, is it really necessary? Can't you just close the browser and open a new instance with CreateBrowser?
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: Is it able to dynamically switch on/off javascript execu

Postby magreenblatt » Wed Nov 30, 2016 1:12 pm

There is now a "webkit.webprefs.javascript_enabled" preference that you can toggle with CefRequestContext::SetPreference. It may require a page reload before it takes effect.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 26 guests