detect an iframe in OnBeforeResourceLoad()

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.

detect an iframe in OnBeforeResourceLoad()

Postby user6294 » Wed Jun 23, 2021 12:59 pm

Hi

In CefRequestHandler::OnBeforeResourceLoad()

is it possible to detect if an iframe is being loaded (or not), then I want to not insert some additional headers (insert some additional headers) into request being processed.


Many Thanks
user6294
Mentor
 
Posts: 83
Joined: Sun Mar 18, 2018 6:57 pm

Re: detect an iframe in OnBeforeResourceLoad()

Postby HarmlessDave » Wed Jun 23, 2021 1:41 pm

Are the subdomains different for the parent and iframe?

I haven't tried this, but you could look at the frame to see if it is a sub-frame, then if yes compare the subdomain of the request against the subdomain of the URL of the main frame for the page.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: detect an iframe in OnBeforeResourceLoad()

Postby magreenblatt » Wed Jun 23, 2021 2:12 pm

The CefRequest argument has a GetResourceType method that should help you (e.g. returning RT_SUB_FRAME).
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: detect an iframe in OnBeforeResourceLoad()

Postby user6294 » Thu Jun 24, 2021 5:25 am

Thank you, that's giving me the info I need for a frame.
user6294
Mentor
 
Posts: 83
Joined: Sun Mar 18, 2018 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 32 guests