1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

SOLVED: XHTML and Firefox problem

Discussion in 'Web Design & Development' started by Mikrondel, Nov 6, 2007.

Thread Status:
Not open for further replies.
  1. Mikrondel

    Mikrondel Thread Starter

    Joined:
    Jun 21, 2005
    Messages:
    43
    Seeing as googling and forum searching brought precious little help, I thought I'd post this to help people with a similar problem in the future.

    Problem: Styles not being applied in Firefox under XHTML 1.0 transitional, but worked with HTML 4.1. An external CSS file that seemed to be ignored. Javascript problems as well. Other browsers fine.

    Cause: Dynamically generated CSS and JS files. Server was reporting MIME type of text/html. HTML page was reporting MIME type of text/css for CSS files. Firefox had been told it was XHTML so was being anal-retentive.

    Fix (for PHP): header('Content-type: text/css'); (or Javascript as appropriate). Remember that header() must be called before ANY html output is sent.
     
  2. tomdkat

    tomdkat Retired Trusted Advisor

    Joined:
    May 6, 2006
    Messages:
    7,148
    Based on the fix, the problem you encountered related to PHP generated HTML pages, in the first place? Wouldn't it be considered "good practice" to have PHP send the proper content types along with the HTML content it's generating?

    Peace...
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/648729

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice