Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
Added onerror fallback functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dc-andysign committed Apr 26, 2024
1 parent de8ce73 commit ff7b1be
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<!DOCTYPE html>
<html lang='en'>
<head>
<script crossorigin src="react.production.min.js"></script>
<script crossorigin src="react-dom.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js" onerror="loadLocalReact()"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" onerror="loadLocalReactDom()"></script>
<script>
function loadLocalReact() {
var script = document.createElement('script');
script.src = '/react.production.min.js';
document.head.appendChild(script);
}
function loadLocalReactDom() {
var script = document.createElement('script');
script.src = '/react-dom.production.min.js';
document.head.appendChild(script);
}
</script>
<script src='/config.js' type='module'></script>
<base href="/" />

Expand Down

0 comments on commit ff7b1be

Please sign in to comment.