Disable per-URL zoom level?

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.

Disable per-URL zoom level?

Postby digory » Tue Jun 27, 2017 3:48 am

CEF remembers the zoom level per scheme + website. I want to disable that and force a zoom level of 100% whenever the browser is pointed to a different location. I tried the following:

Code: Select all
void KisCefClient::OnLoadingStateChange (CefRefPtr<CefBrowser> browser, bool isLoading, bool canGoBack,
   bool canGoForward)
   {
   CEF_REQUIRE_UI_THREAD();
   
   if (browser->IsSame (m_browser))
      {
      CefRefPtr<CefBrowserHost> host = m_browser->GetHost();
      host->SetZoomLevel (0);  // 100%
      }
   }


This works but is not a very nice solution, because the page renders in a different zoom while loading and then changes to 100% when loading finished. Apparently SetZoomLevel does not do anything when loading starts (i.e. when isLoading is true).

Is it possible to do this better so the user does not notice the zoom level is being changed?
digory
Expert
 
Posts: 118
Joined: Wed Oct 26, 2016 3:13 am

Re: Disable per-URL zoom level?

Postby Czarek » Wed Jul 05, 2017 12:09 pm

Related: viewtopic.php?f=6&t=15036
In my case using interval to set zoom level constantly worked fine.
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 102 guests

cron