Edit

Using frames in WebView2 apps

Frames allow you to embed other webpages into your own webpage. A frame is a sub-page or area within a webpage, like a webpage within a webpage.

An iframe is one type of frame. Other types of frames are frameset, portal, embed, fencedFrame, and object. The main WebView2 type for frames is CoreWebView2Frame, which is currently enabled for top-level iframes. Support for other types of frames is planned.

WebView2 supports APIs to interact with iframes. You can:

  • Find out when iframes are created.
  • Find out when iframes are navigating to a different URL. This works the same as state machine Navigation events for WebView2 apps.
  • Communicate between the host app and iframes, sending messages in both directions.
  • Allow the app to ignore the X-Frame-Options HTTP response header.

See also: