Skip to content

DaveAllbirds/request-cancellation-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browser Request Cancellation Test

https://request-cancellation-test.vercel.app

What Is This?

This website details the error when a fetch request gets cancelled in this browser.

Most browsers will cancel ongoing or queued fetch tasks, when unloading the document (spec). It usually happens when navigating away from the current page, which causes a fetch error if there is an unfinished request.

However, browsers are behaving differently and throwing different errors (listed below). It can be really annoying to differentiate them from normal errors if you are using Sentry, or showing a “failed to fetch” hint in the UI.

Test Results for Common Browsers

Field Chrome 95 Safari 14 iOS Safari 14 Firefox 94
.toString() TypeError: Failed to fetch TypeError: cancelled TypeError: cancelled TypeError: NetworkError when attempting to fetch resource.
.name TypeError TypeError TypeError TypeError
.message Failed to fetch cancelled cancelled NetworkError when attempting to fetch resource.
.stack TypeError: Failed to fetch at ...

About

Test the browser request cancellation behavior.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.4%
  • CSS 16.6%