Now that we have the embedded_edit_url
, we can show the document in the iFrame. We'll do this with using the SignWell JavaScript library.
<script type="text/javascript" src="https://static.signwell.com/assets/embedded.js"></script>
Once you've added the SignWell JavaScript library to your website or web application, you'll use the following code to display the iFrame.
var signWellEmbed = new SignWellEmbed({
url: '[embedded_edit_url here]',
events: {
completed: e => {
console.log('completed event: ', e)
//document successfully sent/completed
},
closed: e => {
console.log('closed event: ', e)
//SignWell iFrame closed
}
}
})
signWellEmbed.open()
// The embedded_edit_url expires after it's opened the first time.
// You can regenerate a new embedded_edit_url by making another GET request to the document.
// You can also get a new embedded_edit_url by calling signWellEmbed.newEditUrl in the events.documentLoaded callback.
There are multiple options and events you can use when creating the SignWellEmbed
object.
Name | Description |
---|---|
| This is your embedded edit URL. It's the only required option. |
| The default behavior will open a modal with the iFrame. Instead, using this option, you can pass an ID of a DOM object on your website where the iFrame will be embedded. |
| Whether the document can be closed before a document has been updated and sent. Defaults to |
| A URL where people will be redirected to after they finish updating the document. |
| Determines which step to show when the iFrame is opened. Possible values:
|
| In special cases where the person updating the document is the only person signing, this can be set to Most cases will use the default |
| Whether to show the header on the document view page when editing a document or template. Defaults to |
| Hides the download and PDF buttons/actions when set to |
| Hides the share link button/action when set to |
| Hides the send button when set to |
| Hides the ability to add contacts when set to |
| Hides the ability to add CC recipients when set to |
| Defaults the person's name on typed signatures when set to |
| Hides the progress bar when set to |
| Callback triggered when the document is successfully updated and sent. |
| Callback triggered when the iFrame is loaded. |
| Callback triggered when the document is loaded. |
| Callback triggered when the iFrame is closed. |
| Callback triggered if there is an error. |