Local development

If you're using the HTML or JavaScript API, it's not possible to add the Canva Button to an HTML file on your local machine and open that file in a web browser. If you do this, you'll encounter a Forbidden (403) error.

This is because Canva expects requests to come from:

  • canva.com
  • localhost
  • a domain on Canva's allowlist

This guide explains how to develop locally by serving an HTML file via localhost.

http-server is "a simple, zero-configuration command-line HTTP server." You can use it to make a file (or a directory of files) available via localhost.

You can install http-server via npm or Homebrew.

npm install http-server --global
bash
brew install http-server
bash

Use the cd command to navigate into the directory that contains the HTML file:

cd [dir_path]
bash

To start the local server, run the http-server command:

http-server
bash

By default, the local server becomes available at http://localhost:8080.