By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

Dynamically Loading JS Files

P: n/a
This page:
http://www.hikksworld.com/loadJSFiles/
Is one where I was testing the ability of browsers that can/can't
dynamically load a JS file with one of the three methods:
1)Changing the src property of a script tag.
2)Inserting a script src="" tag in a div via innerHTML
3)Using document.createElement to add a script element.

The fourth method on the page is writing a script tag to a layer, and to
the best of my knowledge it only works in NN4.xx (only tested on
Windows), but MAC testing in NN4.xx would be greatly appreciated as
well, just for my own knowledge.

What I don't have is access to any browsers running on Linux or a MAC
(strictly Windows access). Can I get it tested in browsers other than
whats listed on the page, and in different OS'es?

Any and all feedback is greatly appreciated.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Randy Webb wrote:
<snip>
What I don't have is access to any browsers running on Linux
or a MAC (strictly Windows access). Can I get it tested in
browsers other than whats listed on the page, and in different
OS'es?


Assuming that you haven't changed the script since the last time we
tested this, I had a chance to try out the test script I was using last
time on a Mac a couple of weeks ago. With safari none of the methods
worked. With Mac IE 5 the innerHTML method worked but the SRC setting
method errored at the point of assigning to the - src - property and the
createElement method errored at exactly the same point.

Richard.
Jul 20 '05 #2

P: n/a
In article <Ep********************@comcast.com>,
Randy Webb <hi************@aol.com> wrote:
This page:
http://www.hikksworld.com/loadJSFiles/
Is one where I was testing the ability of browsers that can/can't
dynamically load a JS file with one of the three methods:
1)Changing the src property of a script tag.
2)Inserting a script src="" tag in a div via innerHTML
3)Using document.createElement to add a script element.

The fourth method on the page is writing a script tag to a layer, and to
the best of my knowledge it only works in NN4.xx (only tested on
Windows), but MAC testing in NN4.xx would be greatly appreciated as
well, just for my own knowledge.

What I don't have is access to any browsers running on Linux or a MAC
(strictly Windows access). Can I get it tested in browsers other than
whats listed on the page, and in different OS'es?

Any and all feedback is greatly appreciated.


I am not certain what the output should look like. Could you post
screen images on your site?

I tried on MacOS 10.2.6:
Netscape 7.1 -- Got alert initial js file loaded. Got Windows table.
The last letter r in "Load It In A Layer" was slightly to the right of
the border. The black background went a few characters to the right too.
No vertical boarders were seen in heder row.

IE 5.2 -- Got alert initial js file loaded. Title row columns didn't
align up with data columns on table.

Netscape 4.77 running in classic mode. This is MacOS 9.22 virtual
machine. Results may differ in a native 9.x machine if application
access unsupported hardware devices. Netscape gave up the ghost twice.
I didn't get an alert when initailly loading the page. I did on a
reload I got alert initial js file loaded. When I clicked on Change it
in Netscape 4, I got an alert. I didn't notice any changes. Twice,
half the text in Change it in Netscape 4 text turned red and the other
blue. Clicking on this text, crashed Netscape 4.77.

Robert

Robert
Jul 20 '05 #3

P: n/a
Randy Webb wrote:
This page:
http://www.hikksworld.com/loadJSFiles/
Is one where I was testing the ability of browsers that can/can't
dynamically load a JS file with one of the three methods:
1)Changing the src property of a script tag.
2)Inserting a script src="" tag in a div via innerHTML
3)Using document.createElement to add a script element.

The fourth method on the page is writing a script tag to a layer, and to
the best of my knowledge it only works in NN4.xx (only tested on
Windows), but MAC testing in NN4.xx would be greatly appreciated as
well, just for my own knowledge.

What I don't have is access to any browsers running on Linux or a MAC
(strictly Windows access). Can I get it tested in browsers other than
whats listed on the page, and in different OS'es?

Any and all feedback is greatly appreciated.


Mozilla 1.4 under Linux, only CreateElement works.
Konqueror 3.1.4 under Linux, the first page is unusable(it looks terrible
and I can't click the buttons).
Galeon 1.3.8 under Linux, only CreateElement works.

I also tested it with Lynx, but it was unusable.

--
Remove the 'dont_spam_me' and the dashes before mailing me.
Jul 20 '05 #4

P: n/a
Richard Cornford wrote:
Randy Webb wrote:
<snip>
What I don't have is access to any browsers running on Linux
or a MAC (strictly Windows access). Can I get it tested in
browsers other than whats listed on the page, and in different
OS'es?

Assuming that you haven't changed the script since the last time we
tested this, I had a chance to try out the test script I was using last
time on a Mac a couple of weeks ago. With safari none of the methods
worked. With Mac IE 5 the innerHTML method worked but the SRC setting
method errored at the point of assigning to the - src - property and the
createElement method errored at exactly the same point.


The script I have now is nothing more than the scripts we used before,
with each method invoked via a button, so its the same script.

Thanks.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #5

P: n/a
Robert wrote:
In article <Ep********************@comcast.com>,
Randy Webb <hi************@aol.com> wrote:

This page:
http://www.hikksworld.com/loadJSFiles/
Is one where I was testing the ability of browsers that can/can't
dynamically load a JS file with one of the three methods:
1)Changing the src property of a script tag.
2)Inserting a script src="" tag in a div via innerHTML
3)Using document.createElement to add a script element.

The fourth method on the page is writing a script tag to a layer, and to
the best of my knowledge it only works in NN4.xx (only tested on
Windows), but MAC testing in NN4.xx would be greatly appreciated as
well, just for my own knowledge.

What I don't have is access to any browsers running on Linux or a MAC
(strictly Windows access). Can I get it tested in browsers other than
whats listed on the page, and in different OS'es?

Any and all feedback is greatly appreciated.

I am not certain what the output should look like. Could you post
screen images on your site?


I know the layout of the page needs some work to get it to display
properly, my apologies on that one.
I tried on MacOS 10.2.6:
Netscape 7.1 -- Got alert initial js file loaded. Got Windows table.
The last letter r in "Load It In A Layer" was slightly to the right of
the border. The black background went a few characters to the right too.
No vertical boarders were seen in heder row.
Can you go back and click each black button and let me know which ones
give you an alert? When you click a button, one of two things will
happen. You either get an alert or you dont. If you get the alert, then
it worked for that method.

I added some rudimentary directions to the page. I will try to add some
more tomorrow when I have time. I probably should have waited until I
had the directions on the page before posting :(
IE 5.2 -- Got alert initial js file loaded. Title row columns didn't
align up with data columns on table.

Netscape 4.77 running in classic mode. This is MacOS 9.22 virtual
machine. Results may differ in a native 9.x machine if application
access unsupported hardware devices. Netscape gave up the ghost twice.
I didn't get an alert when initailly loading the page. I did on a
reload I got alert initial js file loaded. When I clicked on Change it
in Netscape 4, I got an alert. I didn't notice any changes. Twice,
half the text in Change it in Netscape 4 text turned red and the other
blue. Clicking on this text, crashed Netscape 4.77.


I gotta get me a MAC :(

Thanks Robert.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #6

P: n/a
Amir Hardon wrote:
Randy Webb wrote:

This page:
http://www.hikksworld.com/loadJSFiles/
Is one where I was testing the ability of browsers that can/can't
dynamically load a JS file with one of the three methods:
1)Changing the src property of a script tag.
2)Inserting a script src="" tag in a div via innerHTML
3)Using document.createElement to add a script element.

The fourth method on the page is writing a script tag to a layer, and to
the best of my knowledge it only works in NN4.xx (only tested on
Windows), but MAC testing in NN4.xx would be greatly appreciated as
well, just for my own knowledge.

What I don't have is access to any browsers running on Linux or a MAC
(strictly Windows access). Can I get it tested in browsers other than
whats listed on the page, and in different OS'es?

Any and all feedback is greatly appreciated.
Mozilla 1.4 under Linux, only CreateElement works.
Konqueror 3.1.4 under Linux, the first page is unusable(it looks terrible
and I can't click the buttons).


I changed it from <buttons> to links, so maybe it will work to test in
Konqueror now.
Galeon 1.3.8 under Linux, only CreateElement works.

I also tested it with Lynx, but it was unusable.


Many thanks.

I have changed a few things in the layout now, so maybe it can be
tested, and added some things to the page that explain what it
should/would do.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #7

P: n/a
Randy Webb wrote:
Richard Cornford wrote:

<snip>
... . With safari none of the methods worked.
With Mac IE 5 the innerHTML method worked but the
SRC setting method errored at the point of assigning
to the - src -property and the createElement method
errored at exactly the same point.


The script I have now is nothing more than the scripts we
used before, with each method invoked via a button, so its
the same script.


My test version is you original functions triggered with buttons so they
are going to be equivalent. The Mac results (especially IE 5's
unwillingness to work with either - src - setting or createElement, the
opposite to Windows IE) made me conclude that dynamically loading
scripts should not be considered viable. I can't think of any good way
testing which, if any, was supported in the browser in use. Except using
setTimeout to try to load some scripts and seeing if any of the
techniques worked, but that would be an ugly hack and there would still
be browsers that just could not do it.

Richard.
Jul 20 '05 #8

P: n/a
Richard Cornford wrote:
Randy Webb wrote:
Richard Cornford wrote:


<snip>
... . With safari none of the methods worked.
With Mac IE 5 the innerHTML method worked but the
SRC setting method errored at the point of assigning
to the - src -property and the createElement method
errored at exactly the same point.


The script I have now is nothing more than the scripts we
used before, with each method invoked via a button, so its
the same script.

My test version is you original functions triggered with buttons so they
are going to be equivalent. The Mac results (especially IE 5's
unwillingness to work with either - src - setting or createElement, the
opposite to Windows IE) made me conclude that dynamically loading
scripts should not be considered viable. I can't think of any good way
testing which, if any, was supported in the browser in use. Except using
setTimeout to try to load some scripts and seeing if any of the
techniques worked, but that would be an ugly hack and there would still
be browsers that just could not do it.


On the test page, its fairly trivial, as each method loads a different
..js file.
createElement loads createElement.js --> alerts 'createElement worked'
innerHTML loads changeHTML.js --> alerts 'innerHTML worked'
changeSource loads changeSource.js --> alerts 'changeSource worked'

After making the list of the stats of what browsers do/don't support
what methods, I was thinking about how to test it to make sure that the
js file actually got loaded, without user input and came up with about
what you did. To try to load it, and then check a variables existence
thats in the .js file.

When I first started playing around with it, I had a personal page that
was in a frameset that I was trying to get rid of and came up with the
idea of trying to load .js files and changing div tags innerHTML
property. Now, its just something I tinker with every now and then to
see what can/cant be done with it. If pushed now to try to do it, I
would probably load a full page in an IFrame with a .src script element
and get it from there. And then in the end say "to heck with this" and
come up with some other approach.

Even then, its still something fun to tinker with :-)

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #9

P: n/a
Randy Webb <hi************@aol.com> wrote in message news:<x5********************@comcast.com>...
Robert wrote:
In article <Ep********************@comcast.com>,
Randy Webb <hi************@aol.com> wrote:

This page:
http://www.hikksworld.com/loadJSFiles/


On MacOS 10.6.2:

iCab 2.9.7 No initial alert. None of four links give alerts.

IE 5.2 I get alert on Change InnerHTML. No alerts on the other
three.

Netscape 7.1 Create element works. The other three do not.

Netscape 4.77 running in classic. No initial alert on first load.
Get message on reload. Both Change it in Netscape 4 and Load It In
A Layer work first time, but not a second time. I do not think
Netscape 4.77 is reliable in this area. I got it to crash in prior
version of page.

Windows 95
IE 4.72 change source got error line 20. Change inner HTML got error
line 12. Create element got error line 16. load it in a layer did
nothing.

I gotta get me a MAC :(
Try ebay. Be sure to get on that runs MacOS 10.3. Great machines
once you get over the higher initial cost. Buy a machine that has
just been discontinued. Try on eMac. iBooks is a good value.


Linux. I believe that most Linux distributions you can load on
multiple machines. Most have dual boot capablities.

Robert
Jul 20 '05 #10

P: n/a
Robert wrote:

<--snip-->
On MacOS 10.6.2:

iCab 2.9.7 No initial alert. None of four links give alerts.

IE 5.2 I get alert on Change InnerHTML. No alerts on the other
three.

Netscape 7.1 Create element works. The other three do not.

Netscape 4.77 running in classic. No initial alert on first load.
Get message on reload. Both Change it in Netscape 4 and Load It In
A Layer work first time, but not a second time. I do not think
Netscape 4.77 is reliable in this area. I got it to crash in prior
version of page.

Windows 95
IE 4.72 change source got error line 20. Change inner HTML got error
line 12. Create element got error line 16. load it in a layer did
nothing.


Thanks Robert.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.