Javascript and Firefox 1.5

L

lmarceglia

Hi,
I have this website that doesn't work in Firefox 1.5:

www.pianetaluca.com

The HTML source is:


<TITLE>PianetaLuca</TITLE>
</HEAD>
<SCRIPT Language="Javascript">
document.writeln('<script type="text/javascript"
src="/contatore.js"><'+'\/script>');
document.writeln('<FRAMESET frameborder="0" border="0"
rows="100,*">');
document.writeln('<FRAME src="menu.html" scrolling="no"
frameborder="no" border="0" name="menu_frame">');
document.writeln('<FRAME src="benven.html" name="mainframe">');
document.writeln('</FRAMESET>');
</script>
</HTML>

With IE everything works fine. But why have I got problems with Firefox
1.5 (and not with the previous versions, say 1.0.3)? Is my javascript
code which is not good?

Thanks a lot for your help.
Luc.
 
R

Randy Webb

Arnulf Sortland said the following on 5/2/2006 5:53 PM:
why use js like this ? are you hiding it for google ?

Good question and maybe.
I recomend using AJAX to do so

Why? There are better ways. One that you included yourself.
 
G

Guest

Hi,
I have this website that doesn't work in Firefox 1.5:

www.pianetaluca.com

The HTML source is:


<TITLE>PianetaLuca</TITLE>
</HEAD>
<SCRIPT Language="Javascript">
document.writeln('<script type="text/javascript"
src="/contatore.js"><'+'\/script>');
document.writeln('<FRAMESET frameborder="0" border="0"
rows="100,*">');
document.writeln('<FRAME src="menu.html" scrolling="no"
frameborder="no" border="0" name="menu_frame">');
document.writeln('<FRAME src="benven.html" name="mainframe">');
document.writeln('</FRAMESET>');
</script>
</HTML>

With IE everything works fine. But why have I got problems with Firefox
1.5 (and not with the previous versions, say 1.0.3)? Is my javascript
code which is not good?

The Javascript is fine. The HTML is junk. I guess that's why it
"works" in IE (and earlier versions of Firefox).

Firefox no longer allows HTML as bad as the page would create.
Is it a frameset or does it have a body? If you can't make up
your mind, firefox just has to guess. Depending upon where the
line that loads the contatore.js appears, it will either assume
it has a body (as you have it now - and so it disallows framesets)
or framesets (and you don't get anything written by contatore.js).


It is a frameset or does the document have a body?
The contatore.js does a document.write to the body.
THe original code claims it is a frameset.

You can have one or the other (some browsers may actually put in a body
with frameset, but ... it ain't right).

The way you have it set up, you get the body (ALL you get is the code
written by contatore.js) (that inclusion appears before the frameset
and so it loads the contatore.js which does a document.write, forcing
a body and so the [frameset] is then illegal).

If you move the 'document.writeln('<script type="text/javascript"' to
the end of the script section, then you get the frameset material first
(but then contatore.js's document.write is illegal and that is missing).

Try using a tool which shows the code after the browser loads the page and
interprets and renders it, itself. Getting a copy of your contatore.js (and
changing the code in the first part so it does not refer to the root, i.e.
it is src="contatore.js" instead of src="/contatore.js") here is what the
original gives as what the browser rendered:


<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="spagnolo,corso,lingua,tedesco,svedese,
pronuncia,spagnola,grammatica,traduzione,traduzioni,luca,Luca,marceglia,Marceglia,Luca
Marceglia,luca marceglia,
programmi,programma,amiga,Amiga,programmi
amiga,bici,viaggi,Londra,Peru,Finlandia
programs,program,amiga programs,italian
grammar,italian,grammar,gramatica,italiana,gramatica
italiana,Vigo,vigo,erasmus,erasmus vigo,socrates,socrates vigo,catalano">
<meta name="Description" content="Questa pagina contiene una grammatica di
spagnolo, descrive la citta' di Vigo per gli studenti Erasmus e mostra i
possibili giri in bicicletta nel bellunese. English available. Versisn en
espaqol.">
<link rel="shortcut icon" href="favicon.ico"><title>PianetaLuca</title>
<script language="Javascript">
document.writeln('<script type="text/javascript"
src="contatore.js"><'+'\/script>');
document.writeln('<FRAMESET frameborder="0" border="0" rows="100,*">');
document.writeln('<FRAME src="menu.html" scrolling="no" frameborder="no"
border="0" name="menu_frame">');
document.writeln('<FRAME src="benven.html" name="mainframe">');
document.writeln('</FRAMESET>');
</script><script type="text/javascript"
src="contatore.js"></script></head><body><a
href="http://www.pianetaluca.com"><img src="/counter/spacer.gif"
name="fixitlink" alt="htmlfixit counter" title="Counter provided by
htmlfixit.com" border="0" height="2" width="1"></a>


Above, you have the body (from contatore.js) and no frameset.


Now, instead, move the first line of the script on the starting page
to the end (so the frameset appears before the load of the contatore.js
script). Then one has:


<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="spagnolo,corso,lingua,tedesco,svedese,
pronuncia,spagnola,grammatica,traduzione,traduzioni,luca,Luca,marceglia,Marceglia,Luca
Marceglia,luca marceglia,
programmi,programma,amiga,Amiga,programmi
amiga,bici,viaggi,Londra,Peru,Finlandia
programs,program,amiga programs,italian
grammar,italian,grammar,gramatica,italiana,gramatica
italiana,Vigo,vigo,erasmus,erasmus vigo,socrates,socrates vigo,catalano">
<meta name="Description" content="Questa pagina contiene una grammatica di
spagnolo, descrive la citta' di Vigo per gli studenti Erasmus e mostra i
possibili giri in bicicletta nel bellunese. English available. Versisn en
espaqol.">
<link rel="shortcut icon" href="favicon.ico"><title>PianetaLuca</title>
<script language="Javascript">
document.writeln('<FRAMESET frameborder="0" border="0" rows="100,*">');
document.writeln('<FRAME src="menu.html" scrolling="no" frameborder="no"
border="0" name="menu_frame">');
document.writeln('<FRAME src="benven.html" name="mainframe">');
document.writeln('</FRAMESET>');
document.writeln('<script type="text/javascript"
src="contatore.js"><'+'\/script>');
</script><script type="text/javascript"
src="contatore.js"></script></head><frameset frameborder="0" border="0"
rows="100,*">
<frame src="menu.html" frameborder="no" border="0" name="menu_frame"
scrolling="no">
<frame src="benven.html" name="mainframe">
</frameset>


Now you have the frameset, but miss out on the stuff written by
contatore.js's document.write (this is a frameset and so has no
body to write to).


Now try changing the document.write in contatore.js to
document.write("<noframes>"+str1+str2+str3+"</noframes>");
and go back to the original order of the lines and get:


<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="keywords" content="spagnolo,corso,lingua,tedesco,svedese,
pronuncia,spagnola,grammatica,traduzione,traduzioni,luca,Luca,marceglia,Marceglia,Luca
Marceglia,luca marceglia,
programmi,programma,amiga,Amiga,programmi
amiga,bici,viaggi,Londra,Peru,Finlandia
programs,program,amiga programs,italian
grammar,italian,grammar,gramatica,italiana,gramatica
italiana,Vigo,vigo,erasmus,erasmus vigo,socrates,socrates vigo,catalano">
<meta name="Description" content="Questa pagina contiene una grammatica di
spagnolo, descrive la citta' di Vigo per gli studenti Erasmus e mostra i
possibili giri in bicicletta nel bellunese. English available. Versisn en
espaqol.">
<link rel="shortcut icon" href="favicon.ico"><title>PianetaLuca</title>
<script language="Javascript">
document.writeln('<script type="text/javascript"
src="contatore.js"><'+'\/script>');
document.writeln('<FRAMESET frameborder="0" border="0" rows="100,*">');
document.writeln('<FRAME src="menu.html" scrolling="no" frameborder="no"
border="0" name="menu_frame">');
document.writeln('<FRAME src="benven.html" name="mainframe">');
document.writeln('</FRAMESET>');
</script><script type="text/javascript"
src="contatore.js"></script></head><noframes><a
href='http://www.pianetaluca.com'><img src="/counter/spacer.gif" border='0'
width='1px' height='2px' name='fixitlink'alt='htmlfixit counter'
title='Counter provided by htmlfixit.com' /></a></noframes><frameset
frameborder="0" border="0" rows="100,*">
<frame src="menu.html" frameborder="no" border="0" name="menu_frame"
scrolling="no">
<frame src="benven.html" name="mainframe">
</frameset>


BINGO! Got it all.

You can write the contatore.js material to the page, but only in a noframes
section if you want the frameset or put in another frame for its contents
from a separate page.
 
L

lmarceglia

Your message is crisp and clear. Thanks a lot for all the info you've
given me.
Now I fully understand why the code wasn't loaded.
I learnt a lor from your post! Thank you so much! Now the page is
working.

You do know HTML!!!
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top