I try to apply this answer with JS but not working to fetch local js file if CDN fails, and i don't know why
<script src="cdn.js" onerror="this.onerror=null;this.src='local.js';"></script>
this way only work
<script type="text/javascript" src="cdn.js"
onerror="this.onerror=null;document.write('<script type=text/javascript src=local.js></script>');"></script>