Change imageloading in runtime

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.

Change imageloading in runtime

Postby thefunkyjoint » Mon May 16, 2016 8:19 pm

Hi,

I use DCEF3 (https://github.com/hgourvest/dcef3), a component that enable Delphi programmers to use CEF library.

It has an option to enable or disable loading images. It works as it's set on design time. But when i change this in runtime, nothing happens.

Is this a limitation of CEF or a bug on DCEF3 ?

Thanks !
thefunkyjoint
Newbie
 
Posts: 8
Joined: Tue Dec 22, 2015 1:35 pm

Re: Change imageloading in runtime

Postby fddima » Mon May 16, 2016 8:25 pm

It is good to specify cross-links when you create cross-posts (you already ask this on stackoverflow.) Some active members follow this forum and SO too. http://stackoverflow.com/questions/37265472/delphi-tchromium-how-to-toggle-between-show-and-hide-images-with-options-image
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Change imageloading in runtime

Postby thefunkyjoint » Mon May 16, 2016 8:27 pm

It's good to have a second opinion, no ? ;)
thefunkyjoint
Newbie
 
Posts: 8
Joined: Tue Dec 22, 2015 1:35 pm

Re: Change imageloading in runtime

Postby fddima » Mon May 16, 2016 8:35 pm

thefunkyjoint wrote:It's good to have a second opinion, no ? ;)

It is just my opinion. All my comments on SO. Without link followers doesn't have chance to find answer, in case if there your question is remains unanswered here. And at same time SO followers can't easily ignore same question.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: Change imageloading in runtime

Postby amaitland » Mon May 16, 2016 8:54 pm

Firstly always cross link your posts, no room for discussion there!

You can load a webpage with `webkit.webprefs.loads_images_automatically` set to false then later change it to true and the images will load (you cannot unload images once they're loaded).

You'd need a newish branch of `CEF` though, at least `2526`.

apidocs3/projects/%28default%29/CefRequestContext.html#SetPreference%28constCefString&,CefRefPtr%3CCefValue%3E,CefString&%29

Quick test shows I can load google without images, invoke a button that changes the preference and images load.

This method must be called on the browser process UI thread.


For anyone interested in this method, this is very important that SetPreference is run on the correct thread.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1292
Joined: Wed Jan 14, 2015 2:35 am

Re: Change imageloading in runtime

Postby fddima » Mon May 16, 2016 9:03 pm

amaitland wrote:You can load a webpage with `webkit.webprefs.loads_images_automatically` set to false then later change it to true and the images will load (you cannot unload images once they're loaded).


Thanks, great point. Actually my workflow has some similarities with topic starter. But i'm ignore not only images, but also any media resources (i.e. also css). May be will try later to optimize logic.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am


Return to Support Forum

Who is online

Users browsing this forum: Majestic-12 [Bot] and 52 guests

cron