Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Emulate the keepalive option by doing a synchronous request #700

Copy link
Copy link
Closed
@alexturpin

Description

@alexturpin
Issue body actions

Historically, when sending data from browsers to server before the page is closed (e.g. through the beforeunload event), XHR synchronous requests have been used.

This is now deprecated in Chrome, with likely more browsers to follow. The prescribed solution is either navigator.sendBeacon (which only works for POST) or fetch with a keepalive flag.

It's not possible to properly polyfill the keepalive flag of course, but sending a synchronous XHR request is a good alternative for older browsers. Would you guys accept a PR that makes synchronous requests when the keepalive flag is set to true, with corresponding documentation in the README? This would make it so that people could use a single API call to support keepalive requests on beforeunload, instead of having to do lots of code branching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.