~ iframe replacement ~

admin

Administrator
Staff member
Hi there everyone,<br />
<br />
I have been looking at the object element<br />
as a replacement for the iframe. The <br />
advantage of this is that it will validate<br />
as XHTML 1.0 Strict.<br />
<br />
Now it works fine in Netscape 7.1<br />
and it works fine in Mozilla 1.6<br />
It also works fine in firefox 0.8<br />
and it even works fine in Opera 7.0<br />
Yes you've guessed it :rolleyes: <br />
I have not mentioned I.E. 6.02<br />
Of course I.E. does not want to play :confused:<br />
Check out the code and see if you have<br />
any ideas<br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br />
<head><br />
<title>mouseover image position</title><br />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /><br />
<br />
<style type="text/css"><br />
/*<![CDATA[*/<br />
body<br />
{<br />
background-color:#aaaaff;<br />
}<br />
#one<br />
{<br />
position:absolute;<br />
left:50%;<br />
top:50%;<br />
margin:-150px 0 0 -250px;<br />
}<br />
object<br />
{<br />
width:500px; <br />
height:300px; <br />
border:solid 1px #000000;<br />
}<br />
/*//]]>*/<br />
</style><br />
<br />
<script type="text/javascript"><br />
//<![CDATA[<br />
function externalLinks() <br />
{ <br />
if (!document.getElementsByTagName) return; <br />
var anchors = document.getElementsByTagName("a"); <br />
for (var i=0; i<anchors.length; i++) <br />
{ <br />
var anchor = anchors; <br />
if (anchor.getAttribute("href") &&anchor.getAttribute("rel") == "external") <br />
anchor.target = "foo"; <br />
} <br />
} <br />
window.onload = externalLinks;<br />
//]]><br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<div id="one"><br />
<object id="foo" name="foo" type="text/html"data="http://www.w3schools.com/"></object><br />
</div><br />
<div><br />
<a href=http://www.htmlforums.com/archive/index.php/"http://www.google.com/"rel="external">this is an object test not an iframe test</a><br />
</div><br />
<br />
</body><br />
</html><!--content-->weird, it works for me in IE.<!--content-->Using IE6 the Google link does not open in the object target. It opens the same as if you used location.href.<br />
<br />
.....Willy<!--content-->Oh, now I see. Could something like<br />
<a href=http://www.htmlforums.com/archive/index.php/"#" onclick="document.getElementById('foo').data = 'http://www.google.com';">google</a><br />
work?<!--content-->I'm sure it can be done thru the DOM by creating a new object element, appending it to the document and removing the current object. After lunch I will try to make a mockup.<br />
<br />
.....Willy<!--content-->Hi there Willy<br />
<br />
Crack this one and we can kiss<br />
the iframe goodbye for ever :cool:<!--content-->this is what I did based on Willy's idea, I'm sure he has a lot to enhance in it but still :)<!--content-->Hi there Jere,<br />
<br />
Well done, that works pretty well :D <br />
Just one minor problem with......I.E.:rolleyes: <br />
When trying to refresh I get an error dialog box.<br />
See attachment<!--content-->I don't get any error on IE 6.0, how hard I ever try - I will Download <!--more--> IE 6.02, which you said you use, and try again.<!--content-->When Download <!--more-->ing IE, I am told that I already have the newest version installed. And M$ should watch out where they let their bulls poop, I got this pile of excrement on my screen when visiting IE's website:<br />
Whether you are a home user simply browsing content or getting e-mail on the Web, an IT administrator deploying and maintaining a rich set of Windows Internet technologies, or a Web developer creating Web content, Internet Explorer 6 SP1 gives you the freedom to experience the best of the Internet.<!--content-->Hi there Jere,<br />
<br />
The image that I attached must<br />
be another I.E. sick joke then :D <br />
On further investigation I could<br />
not even find line 9 char 15 :rolleyes:<!--content-->ROFLMAO :rofl:<!--content-->I get a new window and no errors in 6.0.2800.1106<!--content-->Hi there scoutt,<br />
<br />
Are you talking of my original code<br />
or Jere's amended attachment ?<!--content-->No joy here either.<br />
The best I can do is change the data url put using<br />
IE6 all that is displayed is a blank document which if you<br />
view source contains <p>&#nbsp;</p> But no Google.<br />
<br />
The only success I did have was loading Google into a<br />
hidden division and then using cloneNode to overwrite the<br />
what was originally contained in the one division.<br />
But this seems pointless in that you are loading multiple<br />
pages.<br />
<br />
.....Willy<br />
<br />
BTW: Here is one example of my attempts:<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br />
<head><br />
<title>mouseover image position</title><br />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /><br />
<br />
<style type="text/css"><br />
/*<![CDATA[*/<br />
body<br />
{<br />
background-color:#aaaaff;<br />
}<br />
#one<br />
{<br />
position:absolute;<br />
left:50%;<br />
top:50%;<br />
margin:-150px 0 0 -250px;<br />
}<br />
object<br />
{<br />
width:500px; <br />
height:300px; <br />
border:solid 1px #000000;<br />
}<br />
/*//]]>*/<br />
</style><br />
<br />
<script type="text/javascript"><br />
//<![CDATA[<br />
function loadObject(newUrl){<br />
var oldObj,newObj;<br />
var anchors = document.getElementsByTagName('a'); <br />
oldObj=document.getElementById('foo');<br />
for(var i=0; i<anchors.length; i++){ <br />
var anchor = anchors; <br />
if(anchor.getAttribute('rel') == 'external'){ <br />
newObj = document.createElement('object');<br />
newObj.id = 'foo';<br />
newObj.type = 'text/html';<br />
newObj.data = newUrl;<br />
<br />
oldObj.parentNode.insertBefore(newObj,oldObj);<br />
oldObj.parentNode.removeChild(oldObj);<br />
}<br />
}<br />
<br />
alert(newObj.data);<br />
alert(document.getElementById('foo').data)<br />
alert(document.getElementById('one').innerHTML)<br />
<br />
}<br />
//]]><br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<div id="one"><br />
<object id="foo" type="text/html" data="http://www.w3schools.com/"></object><br />
</div><br />
<div><br />
<a href=http://www.htmlforums.com/archive/index.php/"http://www.google.com/"rel="external" onclick="loadObject(this.href); return false">this is an object test not an iframe test</a><br />
</div><br />
<br />
</body><br />
</html><!--content-->Whoa;<br />
<br />
Before when I tried Agents code I chose to run the code rather than save to my HD and all I got was a blank document in the object. I just tried it again but Download <!--more-->ed the codes to my HD and when opened they worked both locally and on my PWS.<br />
<br />
.....Willy<!--content--> <br />
 <br />
 <br />
So why is I.E. such a party pooper :D<!--content-->Originally posted by coothead <br />
 <br />
 <br />
 <br />
So why is I.E. such a party pooper :D <br />
A question for the ages. :p<!--content-->Originally posted by coothead <br />
Hi there scoutt,<br />
<br />
Are you talking of my original code<br />
or Jere's amended attachment ? <br />
your orignal code from you<br />
<br />
if you are to replace the iframe then try not to use javascript.<!--content-->Originally posted by scoutt <br />
if you are to replace the iframe then try not to use javascript. <br />
IE doesn't like link targets to objects, then what else can you do than use JavaScript?<!--content--> <br />
 <br />
 <br />
 <br />
    + we want it to validate....<br />
    XHTML 1.0 Strict<!--content-->
 
Top