Why
- cdn constantly fails, especially cloudfront
- when cdn fails, each asset blocks an execution for 30 sec
- so user gets 90 sec of white screen if you load 3 assets one by one
- we would like to have smaller time out for cdn
Solution
- load assets asynchronously
- if cdn times out - load fallback
- mark cdn as failed for 1 day and use fallback sources during that
Example
Tech
- assets loaded by xhr to control the order and timeouts
- so scripts should have cors enabled, like cloudfront has
- browser support: ie9+, all recent desktop and mobile