IFrames support

Cross-document IFrames

Note: IFrames that are not cross document are supported out-of-box without adding the SDK to the embedded page. This guide is for supporting cross document IFrames.
To use Cobrowse for Web with cross document IFrames you will need to add our javascript snippet to the page being embedded, i.e. the iframed page. You will then need to add a list of trusted origins of all the parent pages that will be allowed to access the iframed page content for Cobrowse purposes:
1
// NOTE: this configuration should go into the page being embedded, NOT the top level page.
2
CobrowseIO.trustedOrigins = [
3
'https://myexample.com', // parent origin to trust
4
'https://my-other-website.net' // another parent origin to trust
5
];
6
CobrowseIO.start();
Copied!
It is not necessary for the embedded page to contain the Cobrowse license key, if provided it will be ignored.

Running only in an IFrame

A few customers want to run Cobrowse.io only within an IFrame, and not any containing or parent page. This is supported, but requires passing an extra configuration option when starting Cobrowse.
1
CobrowseIO.start({allowIFrameStart:true});
Copied!
Last modified 3mo ago