---
title: "Function: loadEditor() | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/functions/IframeApi.loadEditor/"
---

# Function: loadEditor()

> > **loadEditor**(`editorFrame`, `product`, `config?`, `onFirstLoad?`): [`Promise`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/interfaces/finally.Promise.md)\<[`Editor`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/classes/Editor.Editor.md)\>

Loads the web-to-print editor.

## Parameters

### editorFrame

`HTMLIFrameElement`

The iframe element to place the editor to.

### product

`string` \| `string`[] \| [`IProductDefinition`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/interfaces/ObjectModel.IProductDefinition.md)

The product to load into the editor.

### config?

[`IConfiguration`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/interfaces/ConfigurationInterfaces.IConfiguration.md)

Editor configuration.

### onFirstLoad?

() => `void`

Outdated. A function that handles the first product launch. For details, see [Preloader https://customerscanvas.com/dev/editors/iframe-api/customization/preloader.html\|Preloader](https://customerscanvas.com/dev/editors/iframe-api/customization/preloader.html) topic.

## Returns

[`Promise`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/interfaces/finally.Promise.md)\<[`Editor`](https://customerscanvas.com/docs/on-premises/design-editor/iframe-api/reference/design-editor-iframe/classes/Editor.Editor.md)\>

An instance of the web-to-print editor.

## Example

``` html
<!DOCTYPE html>

   <html lang="en">

   <head>
       <meta charset="utf-8" />
       <title>Customer's Canvas Quick Start Sample Page</title>
       <!-- The IFrame API script. IMPORTANT! Do not remove or change the ID. -->
       <script id="CcIframeApiScript" type="text/javascript" src="/cc/Resources/Generated/IframeApi.js">
       </script>
       <!-- Preloading resources of the editor. -->
       <script>CustomersCanvas.IframeApi.preload();</script>
   </head>

   <body>
       <!-- The iframe to display the editor in. -->
       <iframe id="editorFrame" width="100%" height="800px"></iframe>
   </body>

   <script>
       // Initializing a product with only one template - "BusinessCard.psd".
       const productDefinition = { surfaces: ["BusinessCard"] };
       // Providing the tokenId, which is required in the Secure Mode.
       const config = { tokenId: "95c16577-75fe-4145-87ff-c0ba49d1a554" };
       // Getting the iframe element to display the editor in.
       const iframe = document.getElementById("editorFrame");
       // Loading the editor.
       const editor = await CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition, config)
           // If an error occurred while loading the editor.
           .catch(error => console.error("The editor failed to load with an exception: ", error));
   </script>

   </html>
```
