How to load local files if CDN does not work

I use some CDN js and css files.

I searched on google that how to load local data if the CDN is not working.

I found a good link written as follows

<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script type="text/javascript">
            if (typeof jQuery == 'undefined') {
                document.write(unescape("%3Cscript src='JS/Plugins/jquery-1.8.2.min.js' type='text/javascript'%3E%3C/script%3E"));
            }
        </script>

Yes, it worked, but then I tried another CDN, and then I didn’t download it from the local one. if the CDN does not work, then an error is displayed on my page, and the page does not work properly due to the absence of this js file. means:

<script type="text/javascript" src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
<script type="text/javascript">
    if (typeof jQuery == 'undefined') {
        document.write(unescape("%3Cscript src='Include/JS/JqueryPlugin/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
    }
</script>

in the above case, local jquery.min.js does not load when the above CDN is not working.

similar to how to do for CSS (search on Google and not a single good solution was found).

How to find out which CDN is not working and download the appropriate files from the local one.

Please, help

Thanks in advance

+5
2

:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>    window.jQuery || document.write('<script src="/scripts/jquery.1.9.1.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script>    window.jQuery.ui || document.write('<script src="/scripts/jquery-ui.min.js"><\/script>')</script>

, !

+7

DNS .

CDN . CDN , . - DNS CDN CNAME, .

DNS CDN, . CDN DNS .

0

All Articles