I have an application that uses a mobile ad provider; The way the ad provider works is that I request on the server side, the provider gives me a mark-up and I include that site on my site.
To make the load page faster (which is a requirement that I do not control), I have an AJAX call on my server which then calls to server side, gives markup and I have my mobile Include markup on the scene.
Most of the time, the markup I received is a & lt; Img & gt;
or something like that.
However, when I see & lt; Script & gt; An ad markup is received with
to make the second call dynamically, dynamically loaded & lt; Script & gt; Markup derived from
ends by changing the entire scene; Leaving the ad with me
I have tried some things around it, but have not been successful yet. Is there anything that I can be sure that the dynamically acquired markup does not end by changing the entire page content?
Problem is that the use of advertising is document.write
as it Output is there.
document.write is ruthlessly timely. If the document is written before the download event, then it adds or inserts the text in the page. If it is called after onload, then it completely changes the page , which came before it was destroyed. -
You can temporarily overwrite to write the document. It's as easy as that:
// Overwrite the document with a custom function var old = document.write. Document.write = function (html) {document.getElementById ("Target"). InnerHTML + = html; }; // ad code goes here, // writes to our document. Write sandbox documents. Write ("& lt; div> Ad & lt; / div & gt;"); // Restore the standard document. Write document.write = old;
You can see a little .
Comments
Post a Comment