Last active
          December 12, 2015 08:29 
        
      - 
      
 - 
        
Save svlasov/4744808 to your computer and use it in GitHub Desktop.  
    Async script loading
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!-- dynamic async loading --> | |
| <script type="text/javascript"> | |
| (function(src){ | |
| var po = document.createEkement('script'); | |
| po.type = 'text/javascript'; | |
| po.async = true; //VERY IMPORTANT!!! | |
| po.src = src; | |
| var s = document.getElementsBytagName('script')[0]; | |
| s.parentNode.insertBefore(po, s); | |
| })("https://apis.google.com/js/plusone.js"); | |
| </script> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <!-- static loading: sync vs. defer vs async --> | |
| <script src="//example.com/sync.js"></script> | |
| <script src="//example.com/defer.js" defer></script> | |
| <script src="//example.com/asyns.js" async></script> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment