1 Reply Latest reply on Oct 15, 2005 4:01 PM by kevinstembridge

    External javascript files won't load

    kevinstembridge Newbie

      Hi folks,
      My external javascript files are not being loaded. This is the first time I've tried to load external js files in JBoss/Tomcat so its not something that was working for me before and is now broken.

      I use the following script tag in the 'head' section of my JSP.

      <script type="text/javascript" src="bogus.js"></script>


      The external js file is in the same directory as the JSP. I've tried modifying the mime-mapping in the tomcat conf/web.xml from the default:

      <mime-mapping>
       <extension>js</extension>
       <mime-type>text/javascript</mime-type>
      </mime-mapping>
      


      to the following:

      ...
       <mime-type>application/x-javascript</mime-type>
      ...
      


      I'm using JBoss 4.0.2, Firefox and Struts Tiles.

      Any help is greatly appreciated.
      Cheers

        • 1. Re: External javascript files won't load
          kevinstembridge Newbie

          Well, I spent an hour trying to figure out the solution to this problem before I posted this message. Then the first thing I try after posting just happens to fix the problem.

          My JSP and JS files are stored under the WEB-INF directory. Obviously, the JSPs are there to prevent direct access via the address bar of a browser but I guess it also prevents the browser from loading javascript files as well. Moving the JS files to a directory below the web application root, outside the WEB-INF folder fixed the problem.