Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Javascript/layer problem in Netscape

    Hi guys,

    I have a script that is working fine in everything but NS 4.79, and unfortunately I NEED it to work in that browser. Currently, the script displays an XML file (styled to look pretty via an external stylesheet) in an iframe if the viewer uses IE, and in a layer if the viewer uses NS. The XML file displayed is the one corresponding to the current day of the year (e.g. July 8th).

    Now, all is working fine, except for the fact that in NS 4.79, I get a popup dialog box that says "Alert! Did not find a converter or decoder". I found an article that suggested NS 4.x has trouble when certain content is "blocked," and technically the script is blocking the content that is supposed to be displayed in an iframe from being displayed as such...if that makes sense. After messing around with the code a bit, I managed to get rid of the "alert," but am left with numerous Javascript errors. There are no problems with this in Netscape 7.0 or IE.

    At this point, I want to try a different approach. What I'd like to do is to have the XML file pop up in a new window when an NS user arrives at my page. Unfortunately, I am not a JS programmer (although I'm trying my darndest to be), so I'm not sure what I would need to do to the below code to make that happen. Any suggestions? Thanks!

    In the head:

    <script type="text/javascript">

    function loadRss(){
    var curDate=new Date();
    var dateString=curDate.getMonth()+1+"-"+curDate.getDate()
    var path=dateString+"-e"+".xml";
    var targetFrame=null;

    if(document.layers){
    targetframe=document.layers.rssFrame;
    }else if(document.getElementById){
    targetFrame=document.getElementById("rssFrame");
    }

    targetFrame.src=path;
    }
    </script>



    In the body:
    <body onload="loadRss()">


    Further down in the body:

    <layer src="" style="position:absolute" top="50" left="500" width="400" height="500" name="rssFrame"><iframe src="" id="rssFrame" name="rssFrame" frameborder="0" scrolling="no"width="400px" height="500px"></layer>

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Both your iframe and your layer share the same name which could cause a conflict. And did you miss Glenn's ilayer reference in this thread, and did it not provide the solution to a simular problem?

    ......Willy

    Edit: an example:

    Code:
    <html>
    <head>
     <title>Test Description</title>
     <meta name="description" value="This is the meta-tag!" />
     
     <script language="javascript" type="text/javascript">
     <!--
     function testDescription()
     {
      var txt = document.getElementById("description");
      if (!txt)
      {
       alert("Not found!");
       return false;
      }
      else
      {
       alert(txt.value);
      }
     }
     //-->
     </script>
    </head>
    <body>
     <textarea id="description">This is the text area</textarea><br />
     <button onclick="testDescription();">Test</button>
    </body>
    </html>
    In most browsers, the message will display: "This is the text area". In Internet Explorer, it will display, "This is the meta-tag!".
    Last edited by Willy Duitt; 07-09-2004 at 03:35 AM.

  • #3
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi Willy

    Quote Originally Posted by Willy
    iframe and your layer share the same name which could cause a conflict
    nope. every browser wears blinders; they see only what they want to (understand).

    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #4
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Willy,

    Yes, Glenn's suggestion was a great help a couple of weeks back. There have been new developments in this project since then, however, and I'm so confused after changing the code for this page so many times that I barely remember what's what anymore!

    The current page I'm working on is located here:
    http://www25.brinkster.com/oo7girl/v...ingforums.html

    I still can't seem to get it to work, only this time in ANY browser. Can anyone see a problem with my JS that is preventing today's file (7-9-e.xml) from being loaded automatically by Glenn's script?

    Thanks!

  • #5
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi 007,

    Wild guess, but perhaps because there is no setILayer:

    onclick="return setILayer(this)"
    function insertSrc()
    {


    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #6
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Vinny,

    do you mean that I should put that into every link I have? How would I combine that with the existing

    onclick="return setILayer(this)"


    , and how would that affect the automatically-loading XML document being displayed when a visitor arrives at the page?

    Thanks!

  • #7
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by OO7girl
    <layer src="" style="position:absolute" top="50" left="500" width="400" height="500" name="rssFrame"><iframe src="" id="rssFrame" name="rssFrame" frameborder="0" scrolling="no"width="400px" height="500px"></layer>
    Quote Originally Posted by Willy Duitt
    Both your iframe and your layer share the same name which could cause a conflict
    NN4.x doesn't support iframes, and no other browser supports layers (yes, proper layers, not divs), so the fact that it's the same name in both shouldn't matter since browsers will only see one or the other. so, don't worry about that.


    Quote Originally Posted by OO7girl
    Now, all is working fine, except for the fact that in NS 4.79, I get a popup dialog box that says "Alert! Did not find a converter or decoder". I found an article that suggested NS 4.x has trouble when certain content is "blocked," and technically the script is blocking the content that is supposed to be displayed in an iframe from being displayed as such...if that makes sense. After messing around with the code a bit, I managed to get rid of the "alert," but am left with numerous Javascript errors. There are no problems with this in Netscape 7.0 or IE.
    i could be wrong on this, but as far as i'm aware NN4.x doesn't support XML, hence the error message, "Alert! Did not find a converter or decoder". since it has no internal XML engine, how can it convert your XML document into HTML. This won't be a problem in modern browsers because they have internal XML support, unlike Navigator.

    anyhow, outta curiosity, how come you have to support NN4.79? (didn't think NN when any higher than 4.78, as it happens)

  • #8
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    from: http://www.w3schools.com/browsers/browsers_netscape.asp

    Netscape's 4.x series of browsers have a poor support for CSS and no support for XML.

  • #9
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I guess that about settles it, sadly. Thanks for all your help, but I guess I'm going to have to use a redirect for Netscape 4.79 users and take them to an HTML version of "Today in History" or something similar.

    Currently I'm working on using an RSS-to HTML converter (all my XML files are RSS-validated, and will also be used in an RSS feed) to display the info for NS 4.79 users. Unfortunately, I keep getting a Runtime error when I attempt to view it. Argh!

    And JBot: I have to support NS 4.79 because we have a webmaster here who is very stuck in his ways and absolutely insists on it - there's no other good reason.

  • #10
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs down Infamy Infamy ...

    Quote Originally Posted by OO7girl
    And JBot: I have to support NS 4.79 because we have a webmaster here who is very stuck in his ways and absolutely insists on it - there's no other good reason.
    kick his a** for me.

    i used to have a publishing manager who was like that. he insisted that we had to support NN4.08 and above because that's what they said they'd support in 1998, even tho that was 4 years later and newer and better browsers had come out since then. worse than that, every website had to look identical in each browser, even tho browser's don't work like that.

    all that despite the fact none of out users were using it, never mind NS6+. funny thing was, as soon i left, the criteria changed. i'm sure he had it in for me.

    in the words of British comedy legend Frankie Howard, "Infamy Infamy, they've
    all got it infamy!" if only that was true for some webmasters too, eh!

  • #11
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Hi 007,

    do you mean that I should put that into every link I have? How would I combine that with the existing
    I meant you are calling a function that doesn't exist. The event handler call and the function name don't match -- so I would change the function name.

    I didn't think NN4 supported XML (nn4 is ages old; xml is relatively new), but I figured you knew better since you were trying it.

    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #12
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ugh - so true...it's a bit much really. The number of outdated rules and specifications we're working under here are ridiculous!

    A few examples:
    - all HTML tags must be in upper case
    - No line of code may be longer than 75 characters

    etc etc

    Sheesh!

  • #13
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Vinny:

    No, I totally forgot that NS 4 doesn't support XML. Unfortunately, a rather time-costly memory lapse!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •