Skip to content

Implement Browser Reload Warning to Prevent Accidental Data Loss​ #2192

@tyrann0us

Description

@tyrann0us

Description:

When using WordPress Playground, it's easy to accidentally reload the browser (e.g., by accidentally pressing cmd + R instead of cmd + T), leading to the loss of all unsaved changes and the initiation of a new Playground session. This can be particularly frustrating for users who are not aware that their work will be discarded upon (accidental) reload.​

Proposed Solution:

Implement a browser reload warning that triggers when a user attempts to reload the page. This warning should inform the user that any unsaved changes will be lost and provide options to either proceed with the reload or cancel the action.​

Suggested Implementation:

Utilize the beforeunload event in JavaScript to detect reload attempts and display a confirmation dialog to the user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions