Web component / esm

<form-saver>

See the README for installation and API documentation.

This page imports the class and registers it manually. Use invented details: localStorage keeps drafts on this device. Retention choices affect post-submit data, not draft saving.

Without JavaScript, or if the CDN module fails, the native form still works, but drafts aren’t saved. Keep a copy before leaving. The placeholder /demo-contact endpoint has no submission service.

Class-only import

import { FormSaverElement } from
  'https://esm.sh/@aarongustafson/form-saver@1.1.0/form-saver.js?bundle&target=es2022';
customElements.define('form-saver', FormSaverElement);

<form-saver storage-key="demo:esm">
  <form action="/demo-contact" method="post">
    <label>Name <input name="name"></label>
    <label>Email <input name="email" type="email"></label>
    <button type="submit">Send</button>
  </form>
</form-saver>