---
title: "loadEditor Function"
canonical: https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.loadeditor.htm
archived: true
applies_to:
  - product: "Customer's Canvas On-Premises"
  - product: "Design Editor"
    versions: ["6.15.0", "6.x (may differ)"]
---

**You’re viewing outdated documentation.** [View the latest Customer’s Canvas On-Premises documentation](https://customerscanvas.com/docs/on-premises/).

# loadEditor Function

**Applies to:** Customer's Canvas On-Premises; Design Editor 6.15.0, 6.x (may differ) · **Archived documentation**
 
### Callable
 
- loadEditor(editorFrame:  HTMLIFrameElement, product:  string  |  string []  |  [IProductDefinition](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.objectmodel.iproductdefinition.htm.md), config?:  [IConfiguration](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.configuration.iconfiguration.htm.md), onFirstLoad?:  function ) :  Promise &lt; [Editor](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.editor.htm.md) &gt;

- Loads the web-to-print editor.
  
 - example
     - ```
    <!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".
        var productDefinition = { surfaces: ["BusinessCard"] };
        // Providing the tokenId, which is required in the Secure Mode.
        var config = { tokenId: "95c16577-75fe-4145-87ff-c0ba49d1a554" };
        // Getting the iframe element to display the editor in.
        var iframe = document.getElementById("editorFrame");
        var editor = null;
        // Loading the editor.
        CustomersCanvas.IframeApi.loadEditor(iframe, productDefinition, config)
            // If the editor has been successfully loaded.
            .then(function (e) {
                editor = e;
            })
            // If there was an error thrown when loading the editor.
            .catch(function (error) {
                console.error("The editor failed to load with an exception: ", error);
            });
    </script>
    
    </html>
    ```

#### Parameters

    - ##### editorFrame: HTMLIFrameElement 
  
        The iframe element to place the editor to.
    - ##### product: string  |  string []  |  [IProductDefinition](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.objectmodel.iproductdefinition.htm.md) 
  
        The product to load into the editor. You can configure the product through an [IProductDefinition](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.objectmodel.iproductdefinition.htm.md) instance or construct it from one or more states. For the latter option you need to pass an array of strings (or a single string) that contains product stateIds previously returned by the [Editor.finishProductDesign](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.editor.finishproductdesign.htm.md) or [Editor.saveProduct](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.editor.saveproduct.htm.md) methods.
    - #####  Optional config: [IConfiguration](https://customerscanvas.com/docs/cc6/customerscanvas.iframeapi.configuration.iconfiguration.htm.md) 
  
        Editor configuration.
    - #####  Optional onFirstLoad: function 
  
        *Outdated.* A function that handles the first product launch. For details, see [The Product Loading Screen](https://customerscanvas.com/docs/cc6/product-loading-screen.htm.md) topic.

        - - ( ) :  void

            - #### Returns void

#### Returns Promise &lt; Editor &gt;
 
    An instance of the web-to-print editor.
