Page 1 of 1
iframe and XHTML Strict
Posted: Tue Mar 08, 2005 5:43 am
by zenabi
I'm incorporating a banner ad to my site and the HTML code I was given involves an iframe element.
I'm using XHTML 1.1 Strict and of course it doesn't validate. I don't want to have to change the doctype so I googled around and found a validating replacement - the object element. I replace my code and it works, fantastic I thought until I tried it in IE
IE6 (with SP2) at its default security settings block the banner from appearing because it's getting data from an external site, yet the same data in an iframe works fine in IE!
Does anyone have a solution without having to change the doctype?
Posted: Tue Mar 08, 2005 7:20 am
by feyd
display the data as if it were local. Use a container with overflow set to hidden. Pull the data from the external server, convert it to work with your site via a str_replace() or preg_replace(), then display it along with your site code.
Posted: Tue Mar 08, 2005 10:20 am
by zenabi
Thanks feyd, I've got off to a fairly good start with this:
Code: Select all
$handle = fopen($url, "rb");
$contents = "";
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
echo $contents;
fclose($handle);
Now I have to extract what I need from $contents and make it XHTML pretty

Posted: Tue Mar 08, 2005 10:34 am
by zenabi

The code I'm receiving is shockingly bad! It's from Amazon, take a look: (I've removed the URLs for readability)
Code: Select all
<html>
<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
<TABLE width=468 height=82 border=0 cellspacing=0 cellpadding=1 bgcolor=#000000>
<tr width=466 height=78><TD width=466 height=78>
<TABLE width=466 height=78 border=0 cellspacing=0 cellpadding=0>
<TR bgcolor=#555555 height=78 width=466>
<TD valign=center width=80 height=78>
<A href=http://...><IMG src=http://... height=80 width=98 border=0 alt=amazon.co.uk></a>
</TD>
<td width=80>
<A href=http://...><img src=http://... border=0 vspace=5 alt=cover art></a>
</TD>
<td width=100>
<a href=http://...><FONT face=Arial size=-1 color=f7cb00>Songwriting</FONT></a><br>
<FONT face=Arial size=-2 color=ffffff>Pat Pattison<br>
Our Price: <font color=ffffff>£7.00</FONT>
</TD>
<td width=80>
<a href=http://...><img src=http://... border=0 vspace=5 alt=cover art></a>
</TD>
<td width=100>
<a href=http://...><FONT face=Arial size=-1 color=f7cb00>This Business of Music M...</FONT></a><br>
<FONT face=Arial size=-2 color=ffffff>Tad Lathrop<br>
Our Price: <font color=ffffff>£11.69</font>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</body>
</html>
As you can see it's a mess...font tags and a redundant </td> at the end *sigh* it's gonna take me forever to clean up...
[Edit] I give up, I'm gonna hard code each banner and use some code to randomly cycle through them.
Posted: Tue Mar 08, 2005 11:18 am
by timvw
Posted: Fri Mar 11, 2005 5:08 pm
by Ambush Commander
Or you can use regular expressions to determine what you want. That shouldn't be too difficult.