how to detect ondomready and onload?

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.

how to detect ondomready and onload?

Postby Streamlet » Sun Sep 15, 2019 5:06 am

A.T.T.

Which is closer to CefLoadHandler::OnLoadEnd? and when to trigger the other?
Thank you.
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am

Re: how to detect ondomready and onload?

Postby Czarek » Mon Sep 16, 2019 2:17 am

OnLoadEnd will be called for all frames when loading with all images and other resources is complete. Sometimes it may not be called when some resources fail to load. OnLoadingStateChange will always get called for the main frame even if resources fail to load. To implement ondomready inject custom javascript in OnLoadStart via the onDOMContentLoaded js event. If it needs to communicate with C++ then use Javascript Bindings, see tutorials on wiki pages.
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

Re: how to detect ondomready and onload?

Postby Streamlet » Tue Sep 17, 2019 2:20 am

Czarek wrote:OnLoadEnd will be called for all frames when loading with all images and other resources is complete. Sometimes it may not be called when some resources fail to load. OnLoadingStateChange will always get called for the main frame even if resources fail to load. To implement ondomready inject custom javascript in OnLoadStart via the onDOMContentLoaded js event. If it needs to communicate with C++ then use Javascript Bindings, see tutorials on wiki pages.


Thank you.
Not so perfect for domready solution, as it "pollutes" js env. Any way I'll try it until better solution being discovered.
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am

Re: how to detect ondomready and onload?

Postby Streamlet » Mon Oct 14, 2019 2:52 am

Czarek wrote:OnLoadEnd will be called for all frames when loading with all images and other resources is complete. Sometimes it may not be called when some resources fail to load. OnLoadingStateChange will always get called for the main frame even if resources fail to load. To implement ondomready inject custom javascript in OnLoadStart via the onDOMContentLoaded js event. If it needs to communicate with C++ then use Javascript Bindings, see tutorials on wiki pages.


I found your solution works perfectly well. It is the best way to implement ondomready. Thank you very much again!
Streamlet
Mentor
 
Posts: 61
Joined: Tue Aug 27, 2019 6:47 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 66 guests