SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    May 2001
    Location
    Los Angeles
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Different stylesheet for NS?

    I'm interested in learning how to provide an alternate stylesheet for my NS 4.x vistitors so I get a "somewhat" desired look and feel for both IE and NS.

    Can someone point me in the direction of a browser "sniffer" script and how I would input my changing stylesheet into the script?

    solalmighty
    solalmighty
    More Qs than As.

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Good link

    That's a good link you brief bugger!
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  4. #4
    SitePoint Wizard wdmny's Avatar
    Join Date
    Jul 2000
    Location
    Here
    Posts
    1,010
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternatively, you could use server-side scripting to check the browser then output the stylesheet based off of that. You wouldn't even be able to tell that there were 2 versions.

  5. #5
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I agree with Wes. If you have access to server-side scripting languages, I would go with his suggestion.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  6. #6
    SitePoint Addict
    Join Date
    Sep 2000
    Posts
    230
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here's the script i've created to do what you need..this is on the client instead of the server though.
    Plus..this sniffs for Browser and Platform version..thus applying 5 different sheets:
    IE - PC & Mac
    NS - PC & Mac
    and a default script for all other browsers...

    --------------------------------------------------------------------
    var ua = 0;
    var bd = 0;
    var ss_dir = '../stylesheets/';

    // can we get browser & os info?
    if(navigator.userAgent)
    ua = navigator.userAgent.toLowerCase();
    if(navigator.appName)
    bd = navigator.appName.toLowerCase();

    // if yes,
    if(ua){
    document.write("\n");
    // if M$ os,
    if((ua.indexOf("win")!=-1)||(ua.indexOf("windows")!=-1)){
    if(bd.indexOf("netscape")!=-1)
    document.write('<link rel="stylesheet" type="text/css" href="'+ss_dir+'ms_ns.css">');
    else if(bd.indexOf("microsoft")!=-1)
    document.write('<link rel="stylesheet" type="text/css" href="'+ss_dir+'ms_msie.css">');

    // if mac os,
    } else if((ua.indexOf("mac")!=-1)||(ua.indexOf("ppc")!=-1)){
    if(bd.indexOf("netscape")!=-1)
    document.write('<link rel="stylesheet" type="text/css" href="'+ss_dir+'mac_ns.css">');
    else if(bd.indexOf("microsoft")!=-1)
    document.write('<link rel="stylesheet" type="text/css" href="'+ss_dir+'mac_msie.css">');
    }
    document.write("\n");

    // if no,
    } else {
    document.write('<link rel="stylesheet" type="text/css" href="'+ss_dir+'default.css">');
    document.write("\n");
    }
    ----------------------------------------------------------------------


Bookmarks

Posting Permissions

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