Adding advertisements in iUI

Ever tried adding advertisements to a iUI page?

I tried for a couple of hours until I was tired of “thinking the JS way” and went for the easy(and ugly) solution called iframes. I added the following code and it worked perfectly:

 HTML | 
 
 copy code |
?

1
<iframe scrolling="auto" frameborder="0" style="width:100%; min-height: 300px;" src="/ad.html" sandbox="allow-same-origin allow-forms allow-scripts" allowtransparency="true">

In the ad.html you add the advertisement javascript.

iUI fails with advertisements because it doesn’t support document.write, and all ad platforms I know use it. document.write will only work on the homepage, dynamically loaded pages will fail with document.write and will become a white page with only the ad.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.