SRC parameter not working in Mozilla when path is included

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

    #1

    SRC parameter not working in Mozilla when path is included

    I normally use Mozilla 1.4 on Windows XP Pro.
    As I was developing some test webpages, I discovered that the SRC
    parameter doesn't seem to work when a path is used with the filename.

    In one example, when I want to run a JavaScript from an external file
    (i.e., not inline), I would do the following ...

    <SCRIPT LANGUAGE="JavaS cript" SRC="program.js "> </SCRIPT>

    If "program.js " were in a different subdirectory than the .htm file
    referring to it, the filename would have to be prefixed by the
    pathname as follows ...

    <SCRIPT LANGUAGE="JavaS cript" SRC="/mydir/program.js"> </SCRIPT>

    But when I ran the above from within an .htm file loaded locally into
    Mozilla, it did not work. (The result was as if the above code weren't
    there). However, when I ran the identical code on Internet Explorer
    (v.6), it worked.


    In another, even simpler example, the code to put an image on a
    webpage is ...

    <img src="picture.jp g">

    Again, if "picture.jp g were in a different subdirectory than the .htm
    file referring to it, the filename would have to be prefixed by the
    pathname as follows ...

    <img src="/mydir/picture.jpg">

    When I ran the above from within an .htm file loaded locally into
    Mozilla, it did not work. (The result was as if the above code weren't
    there). However, when I ran the identical code on Internet Explorer
    (v.6), it worked.


    By the way, I tried using backslashes instead of forward slashes. In
    both cases, it still worked on Internet Explorer but not on Mozilla.


    The SRC parameter seems like a fairly frequently used parameter for
    the developers of Mozilla to overlook it. Is this really a bug in
    Mozilla or is it just some option/switch in Mozilla that I didn't set
    properly?
  • Hywel Jenkins

    #2
    Re: SRC parameter not working in Mozilla when path is included

    In article <8028c236.04010 20429.1727fba6@ posting.google. com>,
    wylbur37nospam@ yahoo.com says...[color=blue]
    > I normally use Mozilla 1.4 on Windows XP Pro.
    > As I was developing some test webpages, I discovered that the SRC
    > parameter doesn't seem to work when a path is used with the filename.[/color]

    What's the URL of your site?

    --
    Hywel I do not eat quiche


    Comment

    • Lasse Reichstein Nielsen

      #3
      Re: SRC parameter not working in Mozilla when path is included

      wylbur37nospam@ yahoo.com (wylbur37) writes:
      [color=blue]
      > As I was developing some test webpages, I discovered that the SRC
      > parameter doesn't seem to work when a path is used with the filename.[/color]

      I doubt that. Such a bug would have been caught very quickly.
      [color=blue]
      > In one example, when I want to run a JavaScript from an external file
      > (i.e., not inline), I would do the following ...
      >
      > <SCRIPT LANGUAGE="JavaS cript" SRC="program.js "> </SCRIPT>[/color]

      You should use type="text/javascript" instead of language="JavaS cript".
      It is both forward and backward compatible, and has the advantage of
      beging valid HTML 4.
      [color=blue]
      > If "program.js " were in a different subdirectory than the .htm file
      > referring to it, the filename would have to be prefixed by the
      > pathname as follows ...
      >
      > <SCRIPT LANGUAGE="JavaS cript" SRC="/mydir/program.js"> </SCRIPT>[/color]

      Are you sure you don't mean:
      <SCRIPT LANGUAGE="JavaS cript" SRC="mydir/program.js"> </SCRIPT>
      (no initial "/").
      That would put the script in a subdirectory of the directory of
      the HTML file. With the initial slash, the path is no longer relative
      to the HTML file, but absolute on the server. That is, if your HTML
      file is

      then SRC="/mydir/program.js" refers to:

      while SRC="mydir/program.js" refers to:

      You could even use the relative SRC="../mydir/program.js" to refer to:

      [color=blue]
      > But when I ran the above from within an .htm file loaded locally into
      > Mozilla, it did not work. (The result was as if the above code weren't
      > there). However, when I ran the identical code on Internet Explorer
      > (v.6), it worked.[/color]

      Running locally (i.e., with the file:-protocol) and using absolute
      paths is bound to give trouble.
      [color=blue]
      > The SRC parameter seems like a fairly frequently used parameter for
      > the developers of Mozilla to overlook it. Is this really a bug in
      > Mozilla or is it just some option/switch in Mozilla that I didn't set
      > properly?[/color]

      Try describing your directory structure, then I can say whether it is
      a bug. I have not had any problems with Mozilla (currently using
      Firebird 0.7 for testing and as backup for my main browser)

      /L
      --
      Lasse Reichstein Nielsen - lrn@hotpop.com
      DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
      'Faith without judgement merely degrades the spirit divine.'

      Comment

      Working...