Build a shared note

Build a small public note editor, save through Pagelove's application endpoint, and handle another writer changing the note first. The complete example separates the editor, stored content, and policy into three files. It uses browser fetch; no client-library installation is needed.

This is an anonymous, shared demonstration. Anyone with access to its public URL can read and change the note under the supplied policy. Use a disposable test site and harmless text. This is not a private account, ownership, or sign-in example.

Before you start

1. Download the complete files

Save these downloads with the filenames shown:

Download Purpose Destination
editor.html Form, draft, frozen pending request, readback, and save controls /shared-note/editor.html
notes.html The stored paragraph the visitor edits /shared-note/notes.html
policy.html Exact-path read grants, the paragraph PUT grant, and its shape constraint /shared-note/policy.html

The download URLs end in .txt so you can inspect their source. Check the saved filenames: upload editor.html, not editor.html.txt. The files are generated from the same example used by the live checks, including the editor explained in Save a fragment without losing your draft.

2. Publish and check the policy

Create the directory through WebDAV. Upload notes.html and editor.html, then policy.html. Do not upload these through the public application URL.

The policy permits public GET of those three paths and PUT of #shopping-note in notes.html. It does not grant whole-document PUT or POST. Its shape requires the body to contain one paragraph with that ID; the allowed paragraph has no additional attributes or child elements. Text-length policy is separate: the editor's 500-character limit is a convenience, not a server-enforced limit.

Run the permission and validation checks before treating the deployment as ready. An authoring upload bypasses these application checks; an uploaded policy file alone is not proof of enforcement.

3. Save and confirm

Open /shared-note/editor.html on the public site. The draft should load “Remember the reusable bags.” If it does not, use Troubleshooting before editing the policy.

  1. Change the note and submit the form.
  2. Read the status. An accepted response leaves a frozen copy of the submitted request available for review; it does not silently discard your work.
  3. Use the read control to fetch the server copy. Compare it with your draft and pending submission.
  4. Finish the review explicitly. Reload the editor and check that the saved text returns.

The draft, frozen submission, and last server copy have different jobs. A browser display change is not a persistence check. If a response is lost or unsuccessful, retain the draft and read the target before deciding what to do next. The example does not automatically repeat writes.

4. Try a real conflict

Open the editor in two tabs and let both finish loading. Save from the second tab first. Without rereading in the first tab, submit a different draft there.

The first tab's old validator should receive 412 Precondition Failed. Its draft and frozen request remain visible. Read the current server copy, compare the two versions, choose the text you want, and finish the review before submitting with the refreshed validator. Confirm the result by reading again. Do not remove the condition just to make the conflict disappear.

5. Change the editor without resetting the note

After visitors have edited the note, publish changes to editor.html alone. Re-uploading the starter notes.html would replace their content through trusted authoring. Follow Update and restore a document when content itself needs restoration.

Finish and clean up

Keep a local copy of anything you need. Remove only the disposable /shared-note/ directory through WebDAV, then confirm its files are absent through the authoring connection. Do not remove site-wide rules or other application data.

The live checks exercised this flow in Chrome, anonymous permission refusal, accepted conditional saves, invalid markup and duplicate-ID refusal, stored readback, stale-write rejection, and conditional restoration. They did not test private users, offline persistence, subscriptions, handler side effects, or other browser engines. See verification and versions before applying the example to another environment.