Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript, and iframes #39

Open
chrisgraham opened this issue Feb 10, 2012 · 0 comments
Open

Javascript, and iframes #39

chrisgraham opened this issue Feb 10, 2012 · 0 comments
Labels

Comments

@chrisgraham
Copy link

Columnizer borks adsense really badly. Actually it crashes IE7 completely, and crashes a tab process on IE8.

After a few hours of debugging this and trying various patches, I have not been able to resolve it, and I don't think it can be resolved. So I think it needs documenting instead.

Adsense uses an iframe, which is outputted via Javascript, filled via Javascript, and itself contains Javascript. That just borks for various reasons on different browsers.

I tried patching Columnizer to support a new "protectme" class which would isolate a DOM node into a buffer, remove it from the document tree, and put it back after Columnizer fixes it. Therefore it would not be clone'd (Columnizer clones stuff a lot and it's kind of inevitable for performance). But all browsers bork even on that. Chrome does a reload of the iframe, as does Firefox I think. That causes an ad reload, which Google are not going to like. I think IE just loses the contents completely (as it was written via direct writing, not an iframe src, and IE isn't preserving that) and then it dies because JS events are firing off dead content.

"protectme" is a useful patch though for other scenarios, so I am going to keep it in my "jquery fork" (I've given a URL to this in another issue).

I tried deferring adsense loading, but there's no way to do that. You can't do an after-the-fact document.write, and adsense won't let you run it via innerHTML (probably because it's expected DOM load methods aren't getting fired).

You can't also try and make adsense reload itself fully after Columnizer runs, it just won't do that either.

There are various posts out there talking about moving adsense around using DOM methods. But if they worked once, they don't work now. Or maybe they only work pre-DOM-ready.

So to recap, I implemented a "protectme", which is useful. But generally you can't use adsense with Columnizer and that needs documenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant