Newer versions of Firefox are trouble-makers

D

DL

All right the title may be a bit dramatic but read further pls...

The following js code works fine with Firefox v3.5 (tested with on XP
box)
var f = document.getElementById('frmbox'); // iframe
var Editor1 = (f.contentDocument || f.contentWindow.document);
if (Editor1)
{
// do something here
}

however, it fails to set the var Editor1 with FF3.5.9 (Vista) and
FF3.6.2.(Windows 7). Why? Better, how do we deal with it with these
version of Firefox?

Thanks.
 
D

David Mark

DL said:
All right the title may be a bit dramatic but read further pls...

The following js code works fine with Firefox v3.5 (tested with on XP
box)
var f = document.getElementById('frmbox'); // iframe
var Editor1 = (f.contentDocument || f.contentWindow.document);
if (Editor1)
{
// do something here
}

however, it fails to set the var Editor1 with FF3.5.9 (Vista) and
FF3.6.2.(Windows 7). Why? Better, how do we deal with it with these
version of Firefox?

Post the whole page (or a link to it).
 
R

RobG

All right the title may be a bit dramatic but read further pls...

The following js code works fine with Firefox v3.5 (tested with on XP
box)
        var f = document.getElementById('frmbox'); // iframe
        var Editor1 = (f.contentDocument || f.contentWindow.document);
        if (Editor1)
        {
        // do something here
        }

however, it fails to set the var Editor1 with FF3.5.9 (Vista) and
FF3.6.2.(Windows 7).

Seems to work OK in Firefox 3.6.3 on XP. I suppose you've ruled out
cross-domain issues.

Small test:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>iFrame page</title>
<script type="text/javascript">

window.onload = function() {

var f = document.getElementById('frmbox'); // iframe
var iframeDocument = f.contentDocument ||
f.contentWindow.document;

alert('iframeDocument' +
(iframeDocument? '':' not ') + ' found'
);
};

</script>
</head>
<iframe id="frmbox" src="iframe_content.html"
width="500" height="400"></iframe>
</html>

*** iframe_content.html ***

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<title>iFrame content</title>
<p>iFrame<br><a href="http://www.google.com">Google</a></p>
</html>
 
D

David Mark

RobG said:
Seems to work OK in Firefox 3.6.3 on XP. I suppose you've ruled out
cross-domain issues.

I'm sure it does. Something is rotten in Denmark (or wherever the OP is
from). :)
 
D

DL

Seems to work OK in Firefox 3.6.3 on XP. I suppose you've ruled out
cross-domain issues.

Small test:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title>iFrame page</title>
  <script type="text/javascript">

  window.onload = function() {

    var f = document.getElementById('frmbox'); // iframe
    var iframeDocument = f.contentDocument ||
                         f.contentWindow.document;

    alert('iframeDocument' +
          (iframeDocument? '':' not ') + ' found'
    );
  };

  </script>
</head>
<iframe id="frmbox" src="iframe_content.html"
 width="500" height="400"></iframe>
</html>

*** iframe_content.html ***

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <title>iFrame content</title>
  <p>iFrame<br><a href="http://www.google.com">Google</a></p>
</html>

Never mind I've solved the problem. Most likely I accidentally
deleted a critical line of code while checking the unexpected problem.

Thanks everyone except DM.
 
R

RobG

Never mind I've solved the problem.  Most likely I accidentally
deleted a critical line of code while checking the unexpected problem.

Thanks everyone except DM.

Can't see your issue with his responses. Had you complied with his
original request, your problem may have been solved more quickly. His
second comment was right on the money.

Had you created a minimal example for posting you likely would have
discovered your issue then and a post would not have been necessary.
If that didn't solve your problem, posting the example or a URL to it
would have greatly increased your chances of getting an accurate
response.

You may be interested in:

Posting Questions and Replies to comp.lang.javascript:
General Code Postings, and when to use a URL
<URL: http://www.jibbering.com/faq/notes/posting/#ps1Code >

<FAQENTRY>

The heading of the following section:

Posting Questions and Replies to comp.lang.javascript:
General Code Postings, and when to use a URL
<URL: http://www.jibbering.com/faq/notes/posting/#ps1Code >


might be better as

"Posting code and when to use a URL"

</FAQENTRY>
 
D

David Mark

DL said:
Never mind I've solved the problem. Most likely I accidentally
deleted a critical line of code while checking the unexpected problem.

Thanks everyone except DM.

Uh, excuse you. Who was the *only* one to spend any real time trying to
help you? Shouldn't be hard to narrow down. You didn't exactly get a
ton of responses as you didn't explain your problem very well.

Or perhaps you meant another DM?
 
S

Scott Sauyet

RobG said:
Can't see your issue with his responses. Had you complied with his
original request, your problem may have been solved more quickly. His
second comment was right on the money.

I'll second that.

I've often sparred with David Mark in this forum, but he has done
nothing in this thread but make helpful suggestions. And if you (DL,
not RobG) are discussing the other recent thread involving the two of
you [1], then he was still quite helpful there.

If you've solved the problem, could you please post a brief summary
for others who might face the same issue?

[1] http://preview.tinyurl.com/2cyunkg
 
D

DL

Can't see your issue with his responses. Had you complied with his
original request, your problem may have been solved more quickly. His
second comment was right on the money.

I'll second that.

I've often sparred with David Mark in this forum, but he has done
nothing in this thread but make helpful suggestions.  And if you (DL,
not RobG) are discussing the other recent thread involving the two of
you [1], then he was still quite helpful there.

If you've solved the problem, could you please post a brief summary
for others who might face the same issue?

[1]http://preview.tinyurl.com/2cyunkg

Scott, you have a valid point, DM was helpful in explaining the
contentDocument property.

Don
 
D

David Mark

I'll second that.
I've often sparred with David Mark in this forum, but he has done
nothing in this thread but make helpful suggestions.  And if you (DL,
not RobG) are discussing the other recent thread involving the two of
you [1], then he was still quite helpful there.
If you've solved the problem, could you please post a brief summary
for others who might face the same issue?

Scott, you have a valid point, DM was helpful in explaining the
contentDocument property.

And, seeing as that was your problem, don't you think that deserves a
thank you? I find it quite odd that you thanked "everyone" but me. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top