Embedded Forms
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.
Load the libraries from your install
Section titled “Load the libraries from your install”Your install serves the version of each library that matches it:
| Library | Script | Stylesheet |
|---|---|---|
| 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.
Point them at your install
Section titled “Point them at your install”Tell each library your install’s address before it creates a form:
- Visual Forms JS, Signature Requests JS and Template Editor JS: pass
hostwith your install’s address, as inDocSpring.createVisualForm('.form', { templateId: 'tpl_123456', host: 'https://docspring.example.com' }). If your app and API have separate host names, passappHostwith the app’s instead. - Web Forms JS: set
DocSpring.appHost = "docspring.example.com"(your app’s host name) before you callDocSpring.createWebForm().
Content Security Policy
Section titled “Content Security Policy”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.