I saw this technique to allow backtracking if the CDN is not working. If your js file has some kind of testable property, for example a global variable (I called a marker), you can try to download the file from server A, check the marker and if it is not found, the script will try again.
<script type="text/javascript" src="http://server_A.tld/my.js"></script> <script type="text/javascript"> if( !window.marker ) { document.write( '<script type="text\/javascript" src="http:\/\/server_B.tld\/my.js"><\/script>' ); } </script>
Update There is no danger that all scripts will work using this technique. John Resig explains this in a blog post. . Scripts can be loaded in parallel and in any order, but they must be executed in order.
Here is a fiddle that demonstrates
meouw source share