Page 1 of 1

detect an iframe in OnBeforeResourceLoad()

PostPosted: Wed Jun 23, 2021 12:59 pm
by user6294
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

Re: detect an iframe in OnBeforeResourceLoad()

PostPosted: Wed Jun 23, 2021 1:41 pm
by HarmlessDave
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.

Re: detect an iframe in OnBeforeResourceLoad()

PostPosted: Wed Jun 23, 2021 2:12 pm
by magreenblatt
The CefRequest argument has a GetResourceType method that should help you (e.g. returning RT_SUB_FRAME).

Re: detect an iframe in OnBeforeResourceLoad()

PostPosted: Thu Jun 24, 2021 5:25 am
by user6294
Thank you, that's giving me the info I need for a frame.