IE6 and .js include problem?

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

    IE6 and .js include problem?

    Hello

    Sometimes, I don't know when exactly, when I try to include an external js file as:

    <script src='myfile.js' ></script>

    that .js file goes not included in some cases!!

    To solve it, I had to use PHP as:

    <script>
    <? include ('myfile.js'); ?>
    </script>

    Anyone knows why that .js file is not being included all the time?

    --
    Elias
  • JW

    #2
    Re: IE6 and .js include problem?

    I'm not sure about this, but it may be because you are omitting the
    lang=javascript option.
    I alway use:
    <script language="JavaS cript" src="berekening .js"></script>
    which seems to work just fine.
    JW

    [color=blue]
    > Sometimes, I don't know when exactly, when I try to include an external js[/color]
    file as:[color=blue]
    >
    > <script src='myfile.js' ></script>
    >
    > that .js file goes not included in some cases!![/color]


    Comment

    • Grant Wagner

      #3
      Re: IE6 and .js include problem?

      lallous wrote:
      [color=blue]
      > Hello
      >
      > Sometimes, I don't know when exactly, when I try to include an external js file as:
      >
      > <script src='myfile.js' ></script>
      >
      > that .js file goes not included in some cases!!
      >
      > To solve it, I had to use PHP as:
      >
      > <script>
      > <? include ('myfile.js'); ?>
      > </script>
      >
      > Anyone knows why that .js file is not being included all the time?
      >
      > --
      > Elias[/color]

      A bug in the Web server? A bug in the browser? Assuming the server is responding to
      requests in a timely manner, those are the only two reasons a file referenced by
      <script type="text/javascript" src="myfile.js" ></script> wouldn't always load.

      Check your Web server logs, see if any errors are being reported for the GET on that
      file.

      I'm guessing you're just assuming that it's not always loading because you are seeing
      client-side script errors that leads you to that conclusion. I would suggest that the
      file is always being loaded, but some other bug in your client-side code is causing the
      problems you are seeing.

      Again, check your Web server logs, see if it ever fails to deliver "myfile.js" .

      --
      | Grant Wagner <gwagner@agrico reunited.com>

      * Client-side Javascript and Netscape 4 DOM Reference available at:
      * http://devedge.netscape.com/library/...ce/frames.html

      * Internet Explorer DOM Reference available at:
      * http://msdn.microsoft.com/workshop/a...ence_entry.asp
      * Netscape 6/7 DOM Reference available at:
      * http://www.mozilla.org/docs/dom/domref/
      * Tips for upgrading JavaScript for Netscape 7 / Mozilla
      * http://www.mozilla.org/docs/web-deve...upgrade_2.html


      Comment

      • lallous

        #4
        Re: IE6 and .js include problem?

        Hello

        I tried adding "lang=javascrip t" attribute but that doesn't help.

        No there are no errors in the script, I am checking if the functions
        are getting loaded by doing alert(functionX YZ)

        When that external .js file gets loaded then the alert shows the
        function body, otherwise it shows nothing and I get page errors due to
        the lack of these functions.

        In the same browser (but sometimes different machines), sometimes it
        loads that external .js file using <script> sometimes it doesn't!

        Will refer to the server's log, thanks for the hints.

        --
        Elias

        Grant Wagner <gwagner@agrico reunited.com> wrote in message news:<40E071D6. F2870257@agrico reunited.com>.. .[color=blue]
        > lallous wrote:
        >[color=green]
        > > Hello
        > >
        > > Sometimes, I don't know when exactly, when I try to include an external js file as:
        > >
        > > <script src='myfile.js' ></script>
        > >
        > > that .js file goes not included in some cases!!
        > >
        > > To solve it, I had to use PHP as:
        > >
        > > <script>
        > > <? include ('myfile.js'); ?>
        > > </script>
        > >
        > > Anyone knows why that .js file is not being included all the time?
        > >
        > > --
        > > Elias[/color]
        >
        > A bug in the Web server? A bug in the browser? Assuming the server is responding to
        > requests in a timely manner, those are the only two reasons a file referenced by
        > <script type="text/javascript" src="myfile.js" ></script> wouldn't always load.
        >
        > Check your Web server logs, see if any errors are being reported for the GET on that
        > file.
        >
        > I'm guessing you're just assuming that it's not always loading because you are seeing
        > client-side script errors that leads you to that conclusion. I would suggest that the
        > file is always being loaded, but some other bug in your client-side code is causing the
        > problems you are seeing.
        >
        > Again, check your Web server logs, see if it ever fails to deliver "myfile.js" .
        >
        > --
        > | Grant Wagner <gwagner@agrico reunited.com>[/color]

        Comment

        • Thomas 'PointedEars' Lahn

          #5
          Re: IE6 and .js include problem?

          lallous wrote:[color=blue]
          > Sometimes, I don't know when exactly, when I try to include an
          > external js file as:
          >
          > <script src='myfile.js' ></script>
          >
          > that .js file goes not included in some cases!![/color]

          This should read

          <script type="text/javascript" src="myfile.js" ></script>
          [color=blue]
          > To solve it, I had to use PHP as:
          >
          > <script> <? include ('myfile.js'); ?> </script>[/color]

          This will cause a server-side script error. What
          do you think PHP will do with _J(ava)Script_ code?
          Think first, code second.

          And please, do not crosspost over hierarchies.


          F'Up2 cljs

          PointedEars
          --
          apprentice.c - parses /etc/magic to learn magic

          (from the file-3.40 README)

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: IE6 and .js include problem?

            JW wrote:[color=blue]
            > I'm not sure about this, but it may be because you are omitting the
            > lang=javascript option.[/color]

            It is not an option, it is an attribute with its value.
            [color=blue]
            > I alway use:
            > <script language="JavaS cript" src="berekening .js"></script>[/color]

            You should always use at least

            <script
            type="text/javascript"
            language="JavaS cript"
            src="berekening .js"></script>

            The "type" attribute is required since HTML 4, the "language" attribute
            deprecated (so be sure to declare a Transitional document type if you
            use the latter).
            [color=blue]
            > which seems to work just fine.[/color]

            It *seems* to work.
            [color=blue]
            > [...][/color]

            Please do not top post, see <http://jibbering.com/faq/>.
            And please do not cross-post over hierarchies.


            F'up2 cljs

            PointedEars

            Comment

            • Alberto

              #7
              Re: IE6 and .js include problem?

              Where is the _original_ of this answered post?
              The answer seem to arrave as disaggregated from the thread it arguably
              belonged or should belong to, which I bet is just abother thing we'd blame
              this poor guy for.

              Yet, I'd love to see where's the original, and ask whether we could avoid
              this peculiar exception that makes of your own posts alone the only ones who
              result disaggregated from the thread they were meant to be once loaded in a
              newsreader. No doubt this makes your valuable nickname stand out, yet I'd
              really love to spot the original of this thread.

              A few of us are here because they LIKE and ENJOY to help, and would like to
              give their try to see whether they can help out the poor guy rather than
              just whopping him for the mere sake of it

              tia

              "Thomas 'PointedEars' Lahn" <PointedEars@nu rfuerspam.de> ha scritto nel
              messaggio news:40EAFCE7.4 050407@PointedE ars.de...[color=blue]
              > JW wrote:[color=green]
              > > I'm not sure about this, but it may be because you are omitting the
              > > lang=javascript option.[/color]
              >
              > It is not an option, it is an attribute with its value.
              >[color=green]
              > > I alway use:
              > > <script language="JavaS cript" src="berekening .js"></script>[/color]
              >
              > You should always use at least
              >
              > <script
              > type="text/javascript"
              > language="JavaS cript"
              > src="berekening .js"></script>
              >
              > The "type" attribute is required since HTML 4, the "language" attribute
              > deprecated (so be sure to declare a Transitional document type if you
              > use the latter).
              >[color=green]
              > > which seems to work just fine.[/color]
              >
              > It *seems* to work.
              >[color=green]
              > > [...][/color]
              >
              > Please do not top post, see <http://jibbering.com/faq/>.
              > And please do not cross-post over hierarchies.
              >
              >
              > F'up2 cljs
              >
              > PointedEars[/color]


              Comment

              • Randy Webb

                #8
                Re: IE6 and .js include problem?

                Thomas 'PointedEars' Lahn wrote:

                <--snip-->
                [color=blue][color=green]
                >>To solve it, I had to use PHP as:
                >>
                >><script> <? include ('myfile.js'); ?> </script>[/color]
                >
                >
                > This will cause a server-side script error.[/color]

                Think first, code second, test third, post to News fourth.

                It does *not* cause server side script errors.

                [color=blue]
                >What do you think PHP will do with _J(ava)Script_ code?[/color]

                Absolutely nothing. That is not what the PHP include() does.
                Unless the included file contains PHP tags and PHP script.
                [color=blue]
                > Think first, code second.[/color]

                PWYP

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

                Comment

                • Thomas 'PointedEars' Lahn

                  #9
                  Re: IE6 and .js include problem?

                  Randy Webb wrote:[color=blue]
                  > Thomas 'PointedEars' Lahn wrote:[color=green][color=darkred]
                  >>> To solve it, I had to use PHP as:
                  >>> <script> <? include ('myfile.js'); ?> </script>[/color]
                  >> This will cause a server-side script error.[/color]
                  >
                  > Think first, code second, test third, post to News fourth.
                  >
                  > It does *not* cause server side script errors.[/color]

                  But it is likely to and thus it is bad practice. The JavaScript
                  only needs to contain "<?" or "<?php" (for whatever reason) and
                  the hypertext preprocessor will parse it.
                  [color=blue][color=green]
                  >> What do you think PHP will do with _J(ava)Script_ code?[/color]
                  >
                  > Absolutely nothing. That is not what the PHP include() does.
                  > Unless the included file contains PHP tags and PHP script.[/color]

                  Exactly.


                  PointedEars

                  Comment

                  • lallous

                    #10
                    Re: IE6 and .js include problem?

                    > This should read[color=blue]
                    >
                    > <script type="text/javascript" src="myfile.js" ></script>[/color]

                    That doesn't and didn't help.

                    This is sometimes happening with images, it seems IIS5 is not
                    functioning properly or serving files all the time.

                    [color=blue][color=green]
                    > > To solve it, I had to use PHP as:
                    > >
                    > > <script> <? include ('myfile.js'); ?> </script>[/color]
                    >
                    > This will cause a server-side script error. What
                    > do you think PHP will do with _J(ava)Script_ code?[/color]

                    That works, you should have known that if you know a little about
                    PHP's include() mechanism.
                    [color=blue]
                    > Think first, code second.[/color]
                    I'll remember that.

                    --
                    Elias

                    Comment

                    • Andrew Thompson

                      #11
                      Re: IE6 and .js include problem?

                      On 28 Jun 2004 11:48:12 -0700, lallous wrote:
                      [color=blue]
                      > <script src='myfile.js' ></script>
                      >
                      > that .js file goes not included in some cases!![/color]

                      Out of curiosity, what does this applet report
                      for the mime-type your IIS is assigning to the file?
                      <http://mindprod.com/jgloss/mime.html>

                      --
                      Andrew Thompson
                      http://www.PhySci.org/ Open-source software suite
                      http://www.PhySci.org/codes/ Web & IT Help
                      http://www.1point1C.org/ Science & Technology

                      Comment

                      • Randy Webb

                        #12
                        Re: IE6 and .js include problem?

                        Thomas 'PointedEars' Lahn wrote:[color=blue]
                        > Randy Webb wrote:
                        >[color=green]
                        >>Thomas 'PointedEars' Lahn wrote:
                        >>[color=darkred]
                        >>>>To solve it, I had to use PHP as:
                        >>>><script> <? include ('myfile.js'); ?> </script>
                        >>>
                        >>>This will cause a server-side script error.[/color]
                        >>
                        >>Think first, code second, test third, post to News fourth.
                        >>
                        >>It does *not* cause server side script errors.[/color]
                        >
                        >
                        > But it is likely to and thus it is bad practice. The JavaScript
                        > only needs to contain "<?" or "<?php" (for whatever reason) and
                        > the hypertext preprocessor will parse it.
                        >[/color]

                        Perhaps you should gain access to a PHP-enabled server and test it out.
                        This code:

                        <script> <?php include ('blank1.js'); ?> </script>

                        And in blank1.js:

                        notLoaded = false;
                        <? ... ?>
                        <?php ... ?>

                        Causes *NO* PHP errors, it throws the appropriate JS errors though.
                        Perhaps you should peruse the www.php.net site and learn how it handles
                        the include statement.

                        BTW, your sig line is incorrect.


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

                        Comment

                        • Dr John Stockton

                          #13
                          Re: IE6 and .js include problem?

                          JRS: In article <40EAFCE7.40504 07@PointedEars. de>, seen in
                          news:comp.lang. javascript, Thomas 'PointedEars' Lahn
                          <PointedEars@nu rfuerspam.de> posted at Tue, 6 Jul 2004 21:26:31 :
                          [color=blue]
                          >And please do not cross-post over hierarchies.[/color]

                          There can be no rational objection to cross-posting over different
                          hierarchies. The newsgroups chosen should all be on-topic and
                          reasonably compatible in style; that is all.

                          If there were a rational objection, it would be in, or cited in, the FAQ
                          of c.l.j.

                          --
                          © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                          Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                          Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                          No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                          Comment

                          • Thomas 'PointedEars' Lahn

                            #14
                            Re: IE6 and .js include problem?

                            Randy Webb wrote:[color=blue]
                            > Thomas 'PointedEars' Lahn wrote:[color=green]
                            >> Randy Webb wrote:[color=darkred]
                            >>> Thomas 'PointedEars' Lahn wrote:
                            >>>>> To solve it, I had to use PHP as:
                            >>>>> <script> <? include ('myfile.js'); ?> </script>
                            >>>> This will cause a server-side script error.
                            >>> Think first, code second, test third, post to News fourth.
                            >>> It does *not* cause server side script errors.[/color]
                            >>
                            >> But it is likely to and thus it is bad practice. The JavaScript
                            >> only needs to contain "<?" or "<?php" (for whatever reason) and
                            >> the hypertext preprocessor will parse it.[/color]
                            >
                            > Perhaps you should gain access to a PHP-enabled server and test it out.[/color]

                            I *have* already access to a PHP-enabled server at http://localhost/
                            and I am well-versed in PHP, thank you.
                            [color=blue]
                            > This code:
                            >
                            > <script> <?php include ('blank1.js'); ?> </script>
                            >
                            > And in blank1.js:
                            >
                            > notLoaded = false;
                            > <? ... ?>
                            > <?php ... ?>
                            >
                            > Causes *NO* PHP errors, it throws the appropriate JS errors though.[/color]

                            Of course. I was referring to accidental character sequences in
                            JavaScript code. Don't be stupid!
                            [color=blue]
                            > Perhaps you should peruse the www.php.net site and learn how it handles
                            > the include statement.[/color]

                            Perhaps you should create test cases which reflect what I am saying.
                            [color=blue]
                            > BTW, your sig line is incorrect.[/color]

                            What is a "sig line" and what part of it exactly do you consider incorrect?


                            PointedEars

                            Comment

                            • Thomas 'PointedEars' Lahn

                              #15
                              Re: IE6 and .js include problem?

                              lallous wrote:[color=blue][color=green]
                              >> This should read
                              >>
                              >> <script type="text/javascript" src="myfile.js" ></script>[/color]
                              >
                              > That doesn't and didn't help.
                              >
                              > This is sometimes happening with images, it seems IIS5 is not
                              > functioning properly or serving files all the time.[/color]

                              That is likely. Without the source code
                              of myfile.js, nobody can tell for sure.
                              [color=blue][color=green][color=darkred]
                              >>> To solve it, I had to use PHP as:
                              >>>
                              >>> <script> <? include ('myfile.js'); ?> </script>[/color]
                              >>
                              >> This will cause a server-side script error. What
                              >> do you think PHP will do with _J(ava)Script_ code?[/color]
                              >
                              > That works,[/color]

                              *Sometimes* it does.
                              [color=blue]
                              > you should have known that if you know a little about
                              > PHP's include() mechanism.[/color]

                              YMMD. You are clearly not to teach me PHP, dearie.


                              PointedEars

                              Comment

                              Working...