PDA

View Full Version : What is Netscapes IFRAME code?


aceinstaller
01-04-2001, 09:17 AM
I am currently using an IFRAME on my site, by i have been allerted by my visitors that it doesn't show up in Netscape. Is there something like this for Netscape browsers? Is so is there some javascript i can use to decide what browser it is and the show the correct code?

Thanks

------------------
http://www.ace-installer.com
webmaster@ace-installer.com

whkoh
01-05-2001, 08:52 AM
IFRAMES DO NOT work on all NS platforms. They only work on IE and IE-based browsers.

------------------
Koh Wei Han
Network Engineer
Contact: whkoh@apexmail.com , whkoh@mailandnews.com , whkoh@020.co.uk

aceinstaller
01-05-2001, 09:19 AM
I, i want to know the Netscape equivelant please....

------------------
http://www.ace-installer.com
webmaster@ace-installer.com

kdjoergensen
01-05-2001, 01:15 PM
netscape has the ability to load an external html file into a (clipped) layer. You can either set the src property directly in the tag or use the layer.load(url) method to load a document into the layer after the fact. Techically following should work:

<ilayer id='myilayer'><layer src='mypage.html' id='mylayer'></layer></ilayer>

However, if the page loaded has anything more than very basic html and maybe a small stylesheet you are out of luck. javascripts will be run as 'if they were in the main page itself' and not as if they belonged to the document within the layer (iframe). BUMMER.
As you can imagine, anything just a little fancy inside the layer and you get major errors. same goes for tables with width set to 100%, etc etc (forget applets and cgi programs).

If you are looking to create an 'iframe' in netscape which holds simple html documents, maybe as a way for visitors to pull up further documentation then you should be fine. If you are instead trying to create a 'portal' where regular html pages get loaded into the layer then you will be in big trouble. in latter case use popup windows (window.open(...)) instead (yes, I know.. ugly, but can't think of any other way around).

if you decide to load pages into the layer note following:
1. nest layer tags inside ilayer tags as above. if you try to load a document into an ilayer you will find that netscape4.0-4.7 is very buggy. You can also forget about the <ilayer> tag all together and simply use the layer tag, but wrapping a layer tag inside an ilayer tags gives it more a look and feel of an iframe.
2. use the layer.load() method to load a new document into the layer via script. dont assign the url to the layer's src property. it does not work properly:
e.g. document.myilayer.document.mylayer.load('http://www.somedomain.com/mypage.html')
and NOT: document.myilayer.document.mylayer.src= ...
(dont!!).
using the src property inside the layer's html tag is fine.
3. once you have loaded a new document into the layer, it is a good idea to re-clip the bottom and right values to their original (intended) values as sometimes some 'overflow' is seen below the bottom of the layer (you can do that from a function called by the onload event handler in the layer tag or in the new document which loads into the layer tag)
4. you can put an onload event handler either in the layer tag or in the document which loads into the layer. .. BUT you get only ONE (1). if the document has an onload event handler (the document being loaded into the layer) the layers onload event handler is ignored.

Good luck (I mean it.. you'll need it!!)


[This message has been edited by kdjoergensen (edited 01-05-2001).]

aceinstaller
01-05-2001, 03:29 PM
I know there is some code to show differnet things for different browsers (e.g. netscape and IE). What i want to do is show the IFRAME code for Internet Explorer users, and the iLAYER tag for Netscape. How would you suggest i did this?

Andy


------------------
http://www.ace-installer.com
webmaster@ace-installer.com

kdjoergensen
01-06-2001, 10:00 AM
<IFRAME SRC='MYPAGE.HTML' ID='MYFRAME'></IFRAME>
<ILAYER ID='OUTER'><LAYER ID='MYFRAME' SRC='MYPAGE.HTML'></LAYER></ILAYER>

Above will work in NS6/IE4/IE5/NS4. In NS4 the iframe tag will be ignored and in other browsers the layer/ilayer tags will be ignored. You put the html directly in your page where you want the frame to appear.

To load a page after the fact:
IE4: document.all.myframe.src = ...
IE5/6: document.getElementById('myframe').src = ...
NS4: document.outer.document.myframe.load('page2.html'(l

example

function loadPage(url){

if (document.layers) {
document.outer.document.myframe.load(url);
} else if (document.getElementById() ) {
document.getElementById('myframe').src = url;
} else if (document.all) {
document.all.myframe.src = url;
} else {
mywin = window.open(url,"");
mywin.focus();
}

}

<IFRAME SRC='MYPAGE.HTML' ID='MYFRAME'></IFRAME>
<ILAYER ID='OUTER'><LAYER ID='MYFRAME' SRC='MYPAGE.HTML'></LAYER></ILAYER>
<br>

<a href="loadPage('page2.html')">Page 2</a>

[This message has been edited by kdjoergensen (edited 01-06-2001).]

[This message has been edited by kdjoergensen (edited 01-06-2001).]

aceinstaller
01-07-2001, 06:13 AM
I tried the following code;

<IFRAME SRC='http://www.ace-installer.com/index.html' ID='MYFRAME'>
<ILAYER ID='OUTER'><LAYER ID='MYFRAME' SRC='http://www.ace-installer.com/banner_template.html'></LAYER></ILAYER>

but it only works in IE. In Netscape it looks like it is loading (in the status bar), but then the page just stays blank :o(

Andy


------------------
http://www.ace-installer.com
webmaster@ace-installer.com

Ian
01-07-2001, 09:04 AM
Hi, as Kd explained, both <IFRAME> and <ILAYER> do the same thing but for different browsers, IE: the code has been made cross browser compatible by using both ( or all 3) tags. Therefore you can not specify 2 different urls for one job !! also you did not close the <IFRAME> tag.
Try:
<IFRAME SRC='http://www.ace-installer.com/index.html' ID='MYFRAME'></IFRAME>
<ILAYER ID='OUTER'><LAYER ID='MYFRAME'SRC='http://www.ace-installer.com/index.html'></LAYER></ILAYER>

hope this helps.

------------------
Ian

Web Development - BIG Resources Inc
Head Guide - 123Webmaster.com (http://www.123webmaster.com/)
ian@123webmaster.com
BIG Resources.com (http://www.bigresources.com)
ICQ: 25828668

aceinstaller
01-07-2001, 11:44 AM
I now have changed the code to;

<IFRAME SRC='http://www.ace-installer.com/banner_template.html' ID='MYFRAME'></IFRAME>
<ILAYER ID='OUTER'><LAYER ID='MYFRAME'SRC='http://www.ace-installer.com/banner_template.html'></LAYER></ILAYER>

but now ir doesn't work. I tried it with the other code, but in netscape it took up the whole page. Now i have change the site address it seems not to work at all again except in IE.

Any ideas?

Andy

------------------
http://www.ace-installer.com
webmaster@ace-installer.com

kdjoergensen
01-08-2001, 10:27 AM
Try to load a very simple document:
<html>
<head><title>my title</title>
</head>
<body bgcolor='#ff0000'>
<h1><font color='#ffffff'>HELLO</font></h1>
</body>
</html>

See if it loads correctly.
As mentioned previously, anything more than just a little fancy is a no-go in netscape's layer.
forget about any pages which contain javascripts/external applications (like applets) and any fancy graphics/flash or very rich pictures (regular gif files are ok).

gusrom
03-25-2001, 02:27 PM
try this:

http://home.netscape.com/computing/webbuilding/studio/feature1999v1n3-1.html