I'm having a problem with my browser using the wrong prefix when it fetchs the css and js files for a popup window.

I'm using relative urls for the css and js files e.g. ../styles/mycssfile.css, but instead of just putting the domain on the front, it's putting the whole path to the page that loads into the popup e.g. http://mydomain.com/path-to-page/page.php/styles/mycssfile.css. Then it says that the mime type is wrong - well duh! :-)

I'm using Firefox for testing, but this happens in all the other browsers too, so I guess it's something I'm doing or not doing in the HTML rather than a browser problem.

Does anyone know why it would be doing this and how I can solve the problem?

Debbie

    How about using:

    echo $_SERVER['HOST']."/styles/mycssfile.css";
    

      The HTML is:

      <link href="../styles/mycssfile.css" rel="stylesheet" type="text/css" />
      <script language="JavaScript1.2" type="text/javascript" src="../js/myjsfile.js"></script>
      

      The javascript console in Firefox gives these messages:

      Warning: The stylesheet http://mydomain.com/path/page.php/styles/mycssfile.css was loaded as CSS even though its MIME type, "text/html", is not "text/css".

      and

      Error: syntax error
      Source File: http://mydomain.com/path/page.php/js/myjsfile.js
      Line: 1
      Source Code:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" />

      The second one shows the first line of the page rather than the js file.

      All the pages on the website work properly, it's just the ones in the popup that don't. Curious thing is that the popups work perfectly on my development machine (Windows/Apache), but not when they're served from my live machine (Linux/Apache).

      Any ideas, anyone?

      Debbie

        you can try adding a line to httpd.conf that is
        AddType text/css .css
        and see if it resolves the problem

          I can't do that as I don't have access to httpd.conf on the live machine (it's a hosting company). Also, I'm already interpreting css and js files as php via htaccess.

          Debbie

            Write a Reply...