$('#foo').writeCapture().find('.bar').html(dangerousHtml).end().
find('.baz').load('returnsDanger.php').after(moreDangerousHtml).end().
addClass('loading');
In this context, "dangerous" HTML is any HTML that does or could contain a script tag that uses
document.write
, aka, the evil method. The implementation details are wonderfully complicated, but I've made the usage so simple that any code monkey can just chain whatever they like off of a call to writeCapture() and everything will be perfectly "safe". e.g., document.write will not destroy the application and all the content will show up where it is supposed to. So enjoy.EDIT: the comments here aren't a good place to ask for help. You can get help through GitHub.
5 comments:
Hi Noah,
First of all, I would like to thank you for creating writeCapture. I have been solving our third-party tags problem for over 2 weeks now ( good thing my boss has lots of patience :) ).
The next step for me is to drop jQuery dependency. However, I am clueless on how to use writeCaptureSupport provided in nolib-support.js. The sections "Convenience Functions" and "nolib-support" in the documentation doesn't provide much help.
Any hints or ideas would be very much appreciated.
Thanks.
Hi Jasper,
I've clarified the documentation a bit. Thanks for the feedback. You can run the library without jQuery by including http://github.com/downloads/iamnoah/writeCapture/writeCapture-0.9.0-nolib-min.js. Then just follow the examples in the readme. Please message me on github or open an issue if you have anymore trouble.
Hi Noah,
First of all, I wanted to thank you for your great job. I'm using it for loading OpenX ads after page loaded in order to avoid iframe usage. It works great for most of banners, however for some banner types it puts ad outside of desired container, I assume that there may be some function in script that causes it. It would be awesome if you could take a quick look at the issue and suggest at least direction where I should look for. Here is the test page http://www.gourmandia.org.uk/ads/backup2/index.php (http://screencast.com/t/Z4jmbXz3) and here is the page with iframe http://www.gourmandia.org.uk/ads/backup2/index.php. This is the ad http://www.gourmandia.org.uk/ads/backup2/ad.php
Thank you very much,
Dmitry
Hi Noah,
Thanks for creating writeCapture.js.
It works very well to load ads after page load in FF and google chrome..
But in IE the ads are not changing at all.It only blinks the ad div and shows the same ad.
I have checked the readme for writeCapture.js but not yet able to resolve the issue in IE.
Can you please suggest what need to be done for it.
Hi Noah, Thanks for the wonderful piece of code. But I am facing issue when the document.write(myscript) return iframe content which contain html, head and body inside, the layout of my page is broken and the div containing iframe is not appending in the correct div, instead it is going anywhere behind some "script" tag. I noticed that when we are using $('#divId').writeCapture.html("my script ") and if some script tag after that div (id='divId') is there then the ifram content is not correctly append in that div, instead it is partially appended and the iframe content go and append after the script so my page layout is broken.
Post a Comment