Dynamically Loading JS Files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randy Webb

    Dynamically Loading JS Files

    This page:

    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.create Element 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.javas cript FAQ - http://jibbering.com/faq/
  • Richard Cornford

    #2
    Re: Dynamically Loading JS Files

    Randy Webb wrote:
    <snip>[color=blue]
    > 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?[/color]

    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.


    Comment

    • Robert

      #3
      Re: Dynamically Loading JS Files

      In article <EpmdnYK3KbjmUN 3d4p2dnA@comcas t.com>,
      Randy Webb <hikksnotathome @aol.com> wrote:
      [color=blue]
      > 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.create Element 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.[/color]

      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

      Comment

      • Amir Hardon

        #4
        Re: Dynamically Loading JS Files

        Randy Webb wrote:
        [color=blue]
        > 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.create Element 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.
        >[/color]

        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.

        Comment

        • Randy Webb

          #5
          Re: Dynamically Loading JS Files

          Richard Cornford wrote:[color=blue]
          > Randy Webb wrote:
          > <snip>
          >[color=green]
          >>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?[/color]
          >
          >
          > 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.
          >[/color]

          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.javas cript FAQ - http://jibbering.com/faq/

          Comment

          • Randy Webb

            #6
            Re: Dynamically Loading JS Files

            Robert wrote:
            [color=blue]
            > In article <EpmdnYK3KbjmUN 3d4p2dnA@comcas t.com>,
            > Randy Webb <hikksnotathome @aol.com> wrote:
            >
            >[color=green]
            >>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.create Element 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.[/color]
            >
            >
            > I am not certain what the output should look like. Could you post
            > screen images on your site?[/color]

            I know the layout of the page needs some work to get it to display
            properly, my apologies on that one.
            [color=blue]
            > 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.[/color]

            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 :(
            [color=blue]
            > 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.[/color]

            I gotta get me a MAC :(

            Thanks Robert.


            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ - http://jibbering.com/faq/

            Comment

            • Randy Webb

              #7
              Re: Dynamically Loading JS Files

              Amir Hardon wrote:
              [color=blue]
              > Randy Webb wrote:
              >
              >[color=green]
              >>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.create Element 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.
              >>[/color]
              >
              >
              > 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).[/color]

              I changed it from <buttons> to links, so maybe it will work to test in
              Konqueror now.
              [color=blue]
              > Galeon 1.3.8 under Linux, only CreateElement works.
              >
              > I also tested it with Lynx, but it was unusable.[/color]

              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.javas cript FAQ - http://jibbering.com/faq/

              Comment

              • Richard Cornford

                #8
                Re: Dynamically Loading JS Files

                Randy Webb wrote:[color=blue]
                > Richard Cornford wrote:[/color]
                <snip>[color=blue][color=green]
                >> ... . 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.
                >>[/color]
                >
                > 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.[/color]

                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.


                Comment

                • Randy Webb

                  #9
                  Re: Dynamically Loading JS Files

                  Richard Cornford wrote:
                  [color=blue]
                  > Randy Webb wrote:
                  >[color=green]
                  >>Richard Cornford wrote:[/color]
                  >
                  > <snip>
                  >[color=green][color=darkred]
                  >>>... . 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.
                  >>>[/color]
                  >>
                  >>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.[/color]
                  >
                  >
                  > 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.[/color]

                  On the test page, its fairly trivial, as each method loads a different
                  ..js file.
                  createElement loads createElement.j s --> 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.javas cript FAQ - http://jibbering.com/faq/

                  Comment

                  • Robert

                    #10
                    Re: Dynamically Loading JS Files

                    Randy Webb <hikksnotathome @aol.com> wrote in message news:<x5ednXttc-SMlNzdRVn-ig@comcast.com> ...[color=blue]
                    > Robert wrote:
                    >[color=green]
                    > > In article <EpmdnYK3KbjmUN 3d4p2dnA@comcas t.com>,
                    > > Randy Webb <hikksnotathome @aol.com> wrote:
                    > >
                    > >[color=darkred]
                    > >>This page:
                    > >>http://www.hikksworld.com/loadJSFiles/[/color][/color]
                    >[/color]

                    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.

                    [color=blue]
                    > I gotta get me a MAC :([/color]

                    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.
                    [color=blue]
                    >[/color]

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

                    Robert

                    Comment

                    • Randy Webb

                      #11
                      Re: Dynamically Loading JS Files

                      Robert wrote:

                      <--snip-->
                      [color=blue]
                      > 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.[/color]

                      Thanks Robert.

                      --
                      Randy
                      Chance Favors The Prepared Mind
                      comp.lang.javas cript FAQ - http://jibbering.com/faq/

                      Comment

                      Working...