Navigation

Home
Search
Submit A Resource
Contact Us
About Functionn

Subscription Options


Subscribe By Email (265+)


Lists


Archives

Jun 8, 2012

Author: Hirvesh Posted At: 6/08/2012 Tags: , , ,

crapLoader.js - Loads (Almost) Any Third-Party Script With document.write Asynchronously

Share:
crapLoader.js is a JavaScript library to load ads, widgets or any JavaScript code with document.write in it. The recommended solution is to use iframes for third-party content, but this is not always possible. Normally document.write prevents you from loading a script asynchronously, but this library hijacks document.write and delegates the content loaded from each script into the correct position.


Features

  • Load (almost) any third-party script asynchronously
  • Does not block rendering of your page
  • Your visitors see your content earlier
  • DOMContentLoaded (a.k.a. $(doc).ready ) and window.onload triggered earlier
  • Load the banners in parallel! Except in IE ;(
  • Banners loads faster (at least in theory)
  • Handles recursive scripts
  • Inline and external javascript
  • Inline and external vbscript
  • Buffer document.write, flush on script load event
  • Handles document.getElementById from the buffer
  • Tested (manually) in IE 6-10, latest Firefox, Chrome, Safari, Opera


Disadvantages

  • You never know for sure that all ads will load correctly
  • Ads might circumvent by getting a clean doc.write from an iframe
  • Possible to stop, but won't
  • Using this script might violate the terms of your ad provider
  • You can't use document.write in your own scripts, but why would you?!?
  • document.getElementById will be a tad slower until all scripts loaded with crapLoader are finished loading


Requirements: None
Demohttps://github.com/gregersrygg/crapLoader
License: MIT License

Daily Posts, Be Updated, Subscribe:

Want Free Web Resources? Enter Your Email And We'll Send It To You - Daily! (265+ Subscribers)

Yup, it's that straight forward! Enter your email address below and we'll send you the latest web resources to your inbox, everyday. We don't do spam. Ever.

Trending Posts On Functionn This Week

Share:

Other Interesting Resources:

 


Recent Posts

Popular Categories



Popular Components



Popular Licenses