Connecting Tech Pros Worldwide Forums | Help | Site Map

Multiple JavaScript includes fail

McKirahan
Guest
 
Posts: n/a
#1: Nov 16 '06
Has anyone experienced this (and found a solution)?

I have five files: a .htm that invokes four .js include files.

Only the first alert in the first include is displayed.

This only happens when I run on a client's corporate server.

I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.


<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>
</body>
</html>

alert("test_js.js");

alert("test_js.js1");

alert("test_js.js2");

window.onload = function() {
alert("test_js.js3");
}

I moved the includes into the head;
I took out the last include;
it still fails on one server.

I'm stumped.

If I merge them into one include it works.



Jim Land
Guest
 
Posts: n/a
#2: Nov 16 '06

re: Multiple JavaScript includes fail


"McKirahan" <News@McKirahan.comwrote in news:DeudnXL4
_bBzd8bYnZ2dnUVZ_vadnZ2d@comcast.com:
Quote:
Has anyone experienced this (and found a solution)?
>
I have five files: a .htm that invokes four .js include files.
>
Only the first alert in the first include is displayed.
>
This only happens when I run on a client's corporate server.
>
I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.
>
>
<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>
</body>
</html>
>
alert("test_js.js");
>
alert("test_js.js1");
>
alert("test_js.js2");
>
window.onload = function() {
alert("test_js.js3");
}
>
I moved the includes into the head;
I took out the last include;
it still fails on one server.
>
I'm stumped.
>
If I merge them into one include it works.
Easy to try:
Create four html files on the server, each with only one js include.

<body>
<script type="text/javascript" src="test_js.js"></script>
</body>

<body>
<script type="text/javascript" src="test_js.js1"></script>
</body>

<body>
<script type="text/javascript" src="test_js.js2"></script>
</body>

<body>
<script type="text/javascript" src="test_js.js3"></script>
</body>

Try each html file. Do they all work?

P.S. You can name your files any way you like, but wouldn't test_js1.js
be more logical than test_js.js1?
McKirahan
Guest
 
Posts: n/a
#3: Nov 16 '06

re: Multiple JavaScript includes fail


"Jim Land" <RrrrFfffTttt(NO)@(SPAM)hotmail.comwrote in message
news:Xns987CF27E82108RrrrFfffTttt4396hotm@216.168. 3.44...
Quote:
"McKirahan" <News@McKirahan.comwrote in news:DeudnXL4
_bBzd8bYnZ2dnUVZ_vadnZ2d@comcast.com:
>
Quote:
Has anyone experienced this (and found a solution)?

I have five files: a .htm that invokes four .js include files.

Only the first alert in the first include is displayed.

This only happens when I run on a client's corporate server.

I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.


<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>
</body>
</html>

alert("test_js.js");

alert("test_js.js1");

alert("test_js.js2");

window.onload = function() {
alert("test_js.js3");
}

I moved the includes into the head;
I took out the last include;
it still fails on one server.

I'm stumped.

If I merge them into one include it works.
>
Easy to try:
Create four html files on the server, each with only one js include.
>
<body>
<script type="text/javascript" src="test_js.js"></script>
</body>
>
<body>
<script type="text/javascript" src="test_js.js1"></script>
</body>
>
<body>
<script type="text/javascript" src="test_js.js2"></script>
</body>
>
<body>
<script type="text/javascript" src="test_js.js3"></script>
</body>
>
Try each html file. Do they all work?
>
P.S. You can name your files any way you like, but wouldn't test_js1.js
be more logical than test_js.js1?
Thanks for your reply but you didn't understand.

The example I included fails only on one server.

Each of the includes work -- all they do is show an alert.


Jim Land
Guest
 
Posts: n/a
#4: Nov 16 '06

re: Multiple JavaScript includes fail


"McKirahan" <News@McKirahan.comwrote in news:uZ-
dncAADOIm6MHYnZ2dnUVZ_vmdnZ2d@comcast.com:
Quote:
The example I included fails only on one server.
>
>
Explain a little more, then. How many servers are there? Where do the JS
files reside, on only one server, or on all of the servers?
McKirahan
Guest
 
Posts: n/a
#5: Nov 16 '06

re: Multiple JavaScript includes fail


"Jim Land" <RrrrFfffTttt(NO)@(SPAM)hotmail.comwrote in message
news:Xns987D62931B7F7RrrrFfffTttt4396hotm@216.168. 3.44...
Quote:
"McKirahan" <News@McKirahan.comwrote in news:uZ-
dncAADOIm6MHYnZ2dnUVZ_vmdnZ2d@comcast.com:
>
Quote:
The example I included fails only on one server.
>
Explain a little more, then. How many servers are there? Where do the JS
files reside, on only one server, or on all of the servers?
Thanks again for your interest.

I thought there was enough information in my first post...

The example I posted fails but only on one server.

Of course my example is a stripped down subset of a real
problem -- but it doesn't matter as the example fails!

Create the files, put them in a folder on a Web server,
then open the page via http://whatever/test_js.htm

P.S. I used "test_js" as the filename prefix as I have other
"test_" prefixed files in the same folder.


Jim Land
Guest
 
Posts: n/a
#6: Nov 16 '06

re: Multiple JavaScript includes fail


"McKirahan" <News@McKirahan.comwrote in news:VoCdnZ-
9eMEyEcHYnZ2dnUVZ_uGdnZ2d@comcast.com:
Quote:
Create the files, put them in a folder on a Web server,
then open the page via http://whatever/test_js.htm
>
Can you post the URL so we can test it online?
Kevin Scholl
Guest
 
Posts: n/a
#7: Nov 16 '06

re: Multiple JavaScript includes fail


McKirahan wrote:
Quote:
Has anyone experienced this (and found a solution)?
>
I have five files: a .htm that invokes four .js include files.
>
Only the first alert in the first include is displayed.
>
This only happens when I run on a client's corporate server.
>
I have no problems on a laptop connected to the network
or on my home PC. Any ideas? Thanks in advance.
>
>
<html>
<head>
<title>test_js.htm</title>
</head>
<body>
<script type="text/javascript" src="test_js.js"></script>
<script type="text/javascript" src="test_js.js1"></script>
<script type="text/javascript" src="test_js.js2"></script>
<script type="text/javascript" src="test_js.js3"></script>
The server probably doesn't understand what .js1, .js2, and .js3 files
are. And rightly so, since those are non-standard file extensions.
Rename your files

test_js.js
test_js1.js
test_js2.js
test_js3.js

and correct the associated calls to them, and all should be fine.

HTH.

--

*** Remove the DELETE from my address to reply ***

================================================== ====
Kevin Scholl http://www.ksscholl.com/
kscholl@comcast.DELETE.net
------------------------------------------------------
Information Architecture, Web Design and Development
------------------------------------------------------
We are the music makers, and we are the dreamers of
the dreams...
================================================== ====
McKirahan
Guest
 
Posts: n/a
#8: Nov 17 '06

re: Multiple JavaScript includes fail


"Kevin Scholl" <kscholl@comcast.DELETE.netwrote in message
news:GqednVOgFq-nc8HYnZ2dnUVZ_uKdnZ2d@comcast.com...

[snip]
Quote:
The server probably doesn't understand what .js1, .js2, and .js3 files
are. And rightly so, since those are non-standard file extensions.
Rename your files
>
test_js.js
test_js1.js
test_js2.js
test_js3.js
>
and correct the associated calls to them, and all should be fine.
I'm sure that's it -- I'll test it tomorrow.

Their server is IIS 6.0 while the others are IIS 5.1 and PWS.

Apparently it's a configuration issue.

Thanks.


Closed Thread