The browser owns interaction, presentation, and local navigation. It can help a person fill a form, display progress, and cancel an obsolete read. It does not own record permission or the final stored-data rule. The server validates incoming bytes, checks identity and authorization, chooses a response status, and decides whether a mutation commits. Storage holds durable records under that server contract; browser storage is suitable only for convenience state that can be lost or edited. An origin limits what one page's script can read from another origin, but it does not authorize a caller to edit case 47. A cookie can carry a session reference, yet the server must look it up on every protected request. A cache can save transfer work, yet a private response must not be served to another person. These distinctions make failure cases easier to reason about: ask which layer observed the failure, which layer can repair it, and which layer must reject unsafe input.
Web Development: assign authority to the right layer
Working contract
function acceptInspection({ reviewerId, assignedCases, caseId, note }) {
if (!assignedCases.get(reviewerId)?.has(caseId)) return { status: 403 };
if (typeof note !== "string" || !note.trim()) return { status: 422 };
return { status: 201, note: note.trim() };
}Cost and tradeoffs
For an in-memory set of assignments, the permission check is expected O(1); trimming a note of length L is O(L). A real write adds durable storage and concurrency costs. The browser may offer an early error message, but this server decision must remain authoritative.
Common Mistakes
- Do not assume a browser check is a server rule.
- Do not judge the full page by its response status alone.
- Do not hide a failed operation without a visible recovery path.
Continue
URLs and origins: separate location, query, and fragment; Form submission: validate on the server and return field errors; Sessions and CSRF: keep identity on the server; HTTP caching: validate a changed representation with an ETag.
Ownership exercise
Take a case-note form with a theme preference, a signed-in reviewer, and a saved inspection. Write down which layer may change each value. The browser may hold unfinished input and presentation preference; the server decides identity, permission, validation, and commit; the database preserves the accepted record. Now replace the browser script with a direct HTTP client. Every rule that still protects the record belongs on the server or in a database constraint, not in a hidden button or client-side condition.
Verification
- Change the case ID in a direct request and test the permission decision.
- Clear browser storage and confirm the saved record still exists.
- Expire the session and verify protected reads and writes fail independently of the visible UI.
Apply next
Use Authorization: check permission for this record on every request for the permission boundary and Relational Records and Database Constraints for durable relationships.
