Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question CSS Imports in NS

    I'm not going to say which browser I like better... but here's my dilemma. My style-sheets function as desired in IE, but not NS. So I've decided to use a little javascript to import a different external css depending on the browser. Yet, I can't get an external css to work in NS by either <link> or @import. Any suggestions?
    Timothy Boronczyk

  • #2
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    Can we see the page?

    If the doctype triggers standards compliant mode, your stylesheet *must* be served as text/css. Many misconfigured servers server them as text/plain, which is wrong.

    @import, <link/>, and <?xml-stylesheet?> all work fine in NS6+, so that's not the problem. I'm willing to bet on the mime-type.

  • #3
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well we haven't posted anything to the server, yet. This is just being read by the browser from the harddrive.

    My DOCTYPE is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    my javascript code to select the CSS is:

    <script language="javascript" type="text/javascript"><!--
    var browser=navigator.appName;
    if (browser=="Microsoft Internet Explorer") {
    document.write("<style><!--@import url(msiecss.css);--></style>"); }
    else {
    if (browser=="Netscape") {
    document.write("<style><!--@import url(nscpcss.css);--></style>"); }
    //--></script>
    Timothy Boronczyk

  • #4
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    never mind. I figured it out.

    let's just say {'s are not my friend anymore.

    Timothy Boronczyk

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Victoria, BC, Canada
    Posts
    962
    Thanks
    0
    Thanked 1 Time in 1 Post
    How's that?

  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by bluephoenix
    <script language="javascript" type="text/javascript"><!--
    var browser=navigator.appName;
    if (browser=="Microsoft Internet Explorer") {
    document.write("<style><!--@import url(msiecss.css);--></style>"); }
    else {
    if (browser=="Netscape") {
    document.write("<style><!--@import url(nscpcss.css);--></style>"); }
    }
    //--></script>
    just showing great plain the error.

  • #7
    New Coder
    Join Date
    Dec 2002
    Location
    Central New York
    Posts
    87
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just showing great plain the error.
    Some could argue the error is as follows:

    <script language="javascript" type="text/javascript"><!--
    var browser=navigator.appName;
    if (browser=="Microsoft Internet Explorer") {
    document.write("<style><!--@import url(msiecss.css);--></style>"); }
    else if (browser=="Netscape") {
    document.write("<style><!--@import url(nscpcss.css);--></style>");
    }

    //--></script>

    Timothy Boronczyk


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •