Link to home
Start Free TrialLog in
Avatar of mikeandbee
mikeandbee

asked on

iframes - IE/Netscape switch

I need to use an iframe in Ie but also want to have an alternative for Netscape users - what is the JavaScript I need to make this work? I would still like to display the contents of the iframe in Netscape, but then as text or something. thanks
Avatar of daniel_c
daniel_c

Simple example:

<HTML>
<HEAD>
<TITLE>Layer & IFrame</TITLE>
</HEAD>
<BODY>
Test Layer
<HR SIZE=1>
<script language=Javascript>
     var ns     = document.layers?1:0
     var ie     = document.all?1:0
     
     
     if (ie) {
          document.write ("<iframe src='http://www.yahoo.com'></iframe>");
     }
     else
     {
          document.write ("<layer src='http://www.yahoo.com'></layer>");
     }
     
</script>



</BODY>
</HTML>
there are several alternatives for Netscape:

<layer src="http://www.yahoo.com"></layer>

or recommended for NS:

<ilayer src="http://www.yahoo.com"></ilayer>
or

<div id="mylayer" style='position:absolute;visibility:visible;'></div>

<script>
function document_onload()
{
   document.layers["mylayer"].load("http://www.yahoo.com", 500);
}
window.onload=document_onload;
</script>

regards,
CJ
You do not need javascript-generated document to prepare HTML good for both Netscape and Explorer:

<ILAYER src="http://www.yahoo.com"></ilayer>
<NOLAYER>
<iframe src='http://www.yahoo.com'></iframe>
</NOLAYER>

The difference between ILAYER and LAYER is positioning. ILAYER is equivalent STYLE="position:relative", while LAYER - to STYLE="position:absolute". The IFRAME normally is positioned relatively.
Avatar of mikeandbee

ASKER

Hi,
I don't think any of the above work for me - i have tried all in Netscape but each time nothing appears on the page. When i tried the suggestion from alexcohn, it loaded the <ilayer> in the entire page as opposes to contained in the same area i want the iframe in. Then i tried it again and nothing happened. Netscape is such a pain...but what else can i do?
well, if you want to constrain iframe, you must set the constraints in the tag, e.g. <ILAYER width=20 height=30 bgcolor=red></ILAYER>
ok. but is it possible to add a scrolling="YES" to the ilayer? I tried adding it but it didn't change the ilayer.
ASKER CERTIFIED SOLUTION
Avatar of alexcohn
alexcohn
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You have questions till open more than one year old.  Please navigate to your open questions from your Member Profile and update/finalize them.

Thank you,
Moondancer
Community Support Moderator @ Experts Exchange
This question appears to have been abandoned, all your open questions are posted below.
Your options are:
1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.
For special handling needs, please post a zero point question in the link below, include the question QID/link.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.

Open Qs:
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11677198
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20136244
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20138104
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20139384
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20141051
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20141266
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20147138
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20175597
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11188236

Moondancer
Moderator @ Experts Exchange
 
P.S.  For year 2000 question, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.