JavaScript and client side scripting.
Moderator: General Moderators
zenabi
Forum Commoner
Posts: 84 Joined: Mon Sep 08, 2003 5:26 am
Location: UK
Post
by zenabi » Tue Mar 08, 2005 5:43 am
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?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Mar 08, 2005 7:20 am
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.
zenabi
Forum Commoner
Posts: 84 Joined: Mon Sep 08, 2003 5:26 am
Location: UK
Post
by zenabi » Tue Mar 08, 2005 10:20 am
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
zenabi
Forum Commoner
Posts: 84 Joined: Mon Sep 08, 2003 5:26 am
Location: UK
Post
by zenabi » Tue Mar 08, 2005 10:34 am
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.
timvw
DevNet Master
Posts: 4897 Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium
Post
by timvw » Tue Mar 08, 2005 11:18 am
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Fri Mar 11, 2005 5:08 pm
Or you can use regular expressions to determine what you want. That shouldn't be too difficult.