Skip to content
Start free

Embedded Forms

Open in ClaudeOpen in ChatGPT

The JavaScript libraries that put DocSpring forms and the template editor on a website talk to our hosted service by default. On a page that uses your install, load them from it and tell them where it is.

Your install serves the version of each library that matches it:

LibraryScriptStylesheet
Web Forms JS/assets/embed/web_form.js/assets/embed/web_form.css
Visual Forms JS/assets/embed/visual_form.js/assets/embed/visual_form.css
Signature Requests JS/assets/embed/signature_request.js
Template Editor JS/assets/embed/template_editor.js

For example, https://docspring.example.com/assets/embed/web_form.js. Loading them from your install rather than our CDN keeps them in step with your install’s version, and works where visitors can’t reach the internet. Your install’s own hosted forms load Web Forms JS from it.

Tell each library your install’s address before it creates a form:

  • Visual Forms JS, Signature Requests JS and Template Editor JS: pass host with your install’s address, as in DocSpring.createVisualForm('.form', { templateId: 'tpl_123456', host: 'https://docspring.example.com' }). If your app and API have separate host names, pass appHost with the app’s instead.
  • Web Forms JS: set DocSpring.appHost = "docspring.example.com" (your app’s host name) before you call DocSpring.createWebForm().

If the page that embeds a form has a Content-Security-Policy, allow your install’s host names wherever the Content Security Policy page lists app.docspring.com, api.docspring.com and cdn.docspring.com.