Solved

How to move an Iframe provided by an Ad provider to a different location on the page?

Posted on 2014-01-30
6
368 Views
Last Modified: 2014-02-08
On my website I have ads that are provided by a third party.  However these ads have scripts in them that do a document.write.  I was trying to follow best practices in loading ads last on the page for performance reasons, so the ads are showing up at the bottom of my source, because of the document.write.  When I try to move the wrapper that contains the ad to the correct spot on the page, the ad is disappearing.  It looks like the ad has an IFrame within it so all the body and html of the iframe are disappearing.  Does anyone know how to move this without losing the data?
0
Comment
Question by:Jeffrey Dake
6 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 39823972
can you provide a link please
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 39824226
How did you "move" the wrapper?
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 250 total points
ID: 39824338
If the ad provider is using script within an iframe and the iframe content is host from the vendor's domain; then you are going to run into security violations if you try to modify using script.

You should be discussing the problem with the ad provider. First of all they can contol and can make changes if necessary, and secondly you might be violating you advertising contract if you try to modify any of their components.

Cd&
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 250 total points
ID: 39825193
Here is how

<!DOCTYPE html>
<html>
<head>
<script>
var oldWrite = document.write;
var oldWriteLN = document.writeln;

var adText="";
document.write=function(str) {
  adText += str;
} 
document.writeln=function(str) {
  adText += str+"\n";
} 
window.onload=function() {
  document.getElementById("adWrapper").innerHTML=adText;
}
</script>
</head>
<body>
<div id="adWrapper">
<script src="http://someadserver.com/someadscript.js"></script>
</div>
</body>
</html>

Open in new window

0
 
LVL 10

Accepted Solution

by:
Jeffrey Dake earned 0 total points
ID: 39831321
mplungjan, Thanks for your feedback, but it looked like we were getting some race conditions when multiple ads were fired on the page.  

 COBOLdinosaur, we talked with our ad provider and I think we are just leaning toward switching ad providers.  They claim that they do not have an asynchronous solution, so looks like they are out.
0
 
LVL 10

Author Closing Comment

by:Jeffrey Dake
ID: 39843929
The guys lead me toward contacting the ad provider.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now