Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamically Loading JS Files

7 views
Skip to first unread message

Randy Webb

unread,
Feb 28, 2004, 12:18:04 PM2/28/04
to
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/

Richard Cornford

unread,
Feb 28, 2004, 2:20:16 PM2/28/04
to
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.


Robert

unread,
Feb 28, 2004, 2:45:05 PM2/28/04
to
In article <EpmdnYK3Kbj...@comcast.com>,
Randy Webb <hikksno...@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

Amir Hardon

unread,
Feb 28, 2004, 3:01:41 PM2/28/04
to
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.

Randy Webb

unread,
Feb 28, 2004, 4:25:48 PM2/28/04
to

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 Webb

unread,
Feb 28, 2004, 4:32:20 PM2/28/04
to
Robert wrote:

> In article <EpmdnYK3Kbj...@comcast.com>,
> Randy Webb <hikksno...@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 Webb

unread,
Feb 28, 2004, 4:40:14 PM2/28/04
to
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.

Richard Cornford

unread,
Feb 29, 2004, 8:44:07 AM2/29/04
to
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.


Randy Webb

unread,
Feb 29, 2004, 11:18:44 AM2/29/04
to
Richard Cornford wrote:

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 :-)

Robert

unread,
Feb 29, 2004, 1:29:14 PM2/29/04
to
Randy Webb <hikksno...@aol.com> wrote in message news:<x5ednXttc-S...@comcast.com>...
> Robert wrote:
>
> > In article <EpmdnYK3Kbj...@comcast.com>,
> > Randy Webb <hikksno...@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

Randy Webb

unread,
Feb 29, 2004, 7:28:43 PM2/29/04
to
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.

0 new messages