Resize browser to fit page?

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.

Resize browser to fit page?

Postby HarmlessDave » Mon Sep 25, 2023 10:18 pm

This is for Windows and possibly Mac, using the older non-views windows.

For a page that's finished loading, is there a way to get the window size needed in device pixels to fit the page without scrolling? We want to have a floating window that is only as big as it needs to be to fit the page.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: Resize browser to fit page?

Postby magreenblatt » Tue Sep 26, 2023 11:55 am

You could likely compute that with JavaScript, and then report it to the native code (via JS bindings) to perform the resize.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Resize browser to fit page?

Postby HarmlessDave » Tue Sep 26, 2023 1:52 pm

Thanks, I found a StackOverflow post using CefSharp that looks like it uses that idea so I'll try converting it into C++ / "regular" CEF : https://stackoverflow.com/questions/442 ... ge-content
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 227 guests