Support us .Net Basics C# SQL ASP.NET Aarvi MVC Slides C# Programs Subscribe Download

Part 100 - What if CDN is down

Suggested Videos 
Part 97 - Implement autocomplete textbox functionality in mvc
Part 98 - What is JavaScript minification
Part 99 - What is CDN - Content Delivery Network



In this video we will disccuss
1. What if CDN is down?
2. How to fallback from CDN to use local copy of Jquery?

There are several benefits of referencing a resource from a CDN. We discussed these in Part 99 of asp.net mvc tutorial.



A CDN is an external resource and beyond our control. So, what if, CDN is down? How can we fall back from CDN to use local copy of Jquery.

The following code checks if jQuery is loaded and if it isn't, the jquery script will be loaded from our web server.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" 
        type="text/javascript">
</script>

<script type="text/javascript">
    window.jQuery || document.write('<script src="/MVCDemo/Scripts/jquery-1.7.1.min.js">\x3C/script>')
</script>

\x3C is hexadecimal for <

11 comments:

  1. Respected sir,

    Waiting for Your new Viedeos on ASP.NET MVC Please upload it...

    ReplyDelete
  2. Hi venkat,


    This is yeswanth from Hyderabad, how to use a technology which is suitable to application, so that we can migrate to one over other at any point of time, and i need the advantages of one technology over other technologies.

    ReplyDelete
  3. Hello Sir,
    Sir all your Videos are much helpfull to me for learning ASP.NET MVC. All Video are working good but when it comes to jquery some are working and some are not working so can you please help the jquery demo... how to improve its workin..

    Thank you...

    ReplyDelete
  4. You done GREAT Job, Keep it up...........

    ReplyDelete
  5. sir...You Are Great Donner ..most of the .net developer remember to you for your this great job....keep it up sir.

    ReplyDelete
  6. How to call fallback CDN from bundling? (ASP.NET MVC)

    ReplyDelete
  7. Venkat,
    You are amazing, generous and with unlimited gift of teaching power from God.
    Your videos have helped me too much.
    I learnt what does kindness does mean from your act of sharing all these free videos for millions of people throughout the world.
    Stay blessed !
    Shen

    ReplyDelete
  8. Venkat,
    You are amazing, generous and with unlimited gift of teaching power from God.
    Your videos have helped me too much.
    I learnt what does kindness does mean from your act of sharing all these free videos for millions of people throughout the world.
    Stay blessed !
    Shen

    ReplyDelete
  9. HI VENKAT SIR,
    PEOPLE EARN MONEY... YOU ARE EARNING GOODWILL AND GOODWILL ASWAYS SUPERIOR THAN MONEY... GOD BLESS YOU...:)

    ReplyDelete
  10. 1/21/2018 - Finally Done with 100 Tutorials.
    Thanks Venkat :)

    ReplyDelete
  11. Thank you Sir for all the great videos and details !

    ReplyDelete

It would be great if you can help share these free resources