Detect when external JavaScript or CSS resources fail to load - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:css

Description

Detect when external JavaScript or CSS resources fail to load

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> 
  <style id="compiled-css" type="text/css">

body {/*from  w  w w  .  j ava 2s .c o  m*/
   background: #000;
}


      </style> 
  <script type="text/javascript">
    $(window).load(function(){
if ($('body').css('backgroundColor') !== 'rgb(0, 0, 0)') {
   console.log('Styles didn\'t apply');
}
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials