forked from shenjunru/LazyWrite
-
Notifications
You must be signed in to change notification settings - Fork 0
JavaScript: deferred document.write implementation
License
zation/LazyWrite
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
LazyWrite is build to have the best compromise between a good page load and write a complex external data in your page (like Advertising). This allow you to control when should those data start to render or load. Advantages * Increase highly the page load * Stop freezing client navigator * Forget iframe calls * No other library required (like jQuery) * No(or less) change of existing code Browser Support: * IE [tested on v6+] * FireFox [tested on v2+] * Chrome [tested on v5+] * Safari [tested on v4+] * Opera [tested on v9.6+] Demo: http://project.xfsn.net/lazywrite/demo/index.html Example: Google AdSense <script src="lazywrite.js"></script> <script> google_ad_client = "ca-pub-5840687392233497"; google_ad_slot = "9902234827"; google_ad_width = 728; google_ad_height = 90; document.write('<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js"><\/script>'); </script> <script>$(document).ready(LazyWrite.process); // jQuery</script> API: * LazyWrite.write() original document.write function. * LazyWrite.prepare() replace original document.write functions by lazy engine. run once when the LazyWrite loaded. * LazyWrite.render(String content, [String holder], [Function callback]) add content to later render. callback function has one parameter: an array of catched exceptions. * LazyWrite.process() start to process the contents. * LazyWrite.findScripts([String type]) find and add all custom typed script elements.
About
JavaScript: deferred document.write implementation
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published