#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2002
    Posts
    1
    Rep Power
    0

    browser dependant css file possible?


    At the moment I have a browser detect on my page that will redirect ns users to a ns specific page.

    What I would like to do for my next project is merely redirect them to a different style sheet.

    Is this possible?

    Please help!!
  2. #2
  3. Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Oct 2001
    Location
    New Zealand
    Posts
    1,774
    Rep Power
    24
    One way is to just do your browser detect then document.write the links to external CSS files within a switch control.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    another way would be "javascript style sheets" which is a netscape-4-only-way for redefining css styles.

    you use standard-css for all browsers, but for netscape you set the styles in the onload-handler of the body using javascript.

    look at http://devedge.netscape.com for further reference.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    <script type="text/javascript" language="JavaScript1.2">

    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4))
    document.write('<link rel="stylesheet" type="text/css" href="ns4_style.css">');
    else document.write('<link rel="stylesheet" type="text/css" href="default_style.css">');

    </script>

    In the <head>er; file names (blue), up to you...
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    M.Hirsch -

    You've got it backwards...

    http://css.nu/articles/About-JSSS.html
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Oct 2000
    Location
    Back in the real world.
    Posts
    5,966
    Rep Power
    190
    what is "backwards" about this?
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2001
    Posts
    765
    Rep Power
    13
    another way would be "javascript style sheets" which is a netscape-4-only-way for redefining css styles.
    Now a decision was taken to build onto the already available JSSS engine and just produce a "translator" from CSS1 over to JSSS.
    You've got JSSS 'redefining' CSS - it's the other way around.

IMN logo majestic logo threadwatch logo seochat tools logo