SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru redhillccwebmas's Avatar
    Join Date
    Jun 2005
    Posts
    989
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stylesheet switcher - why is server-side better than client-side?

    Hi there,

    I am currently developing a site where accessibiliity to the visually-impaired is very important. I was looking into stylesheet switchers and finally settled on a server-side solution as I know very little JS. On the site where I got the code from, it mentioned that a server-side solution would be more accessible than a front-end - why would this be? Surely if a browser that someone is using has JS disabled, it would be a screen reader and nothing else?

    Cheers for your help

    James

  2. #2
    SitePoint Wizard bronze trophy C. Ankerstjerne's Avatar
    Join Date
    Jan 2004
    Location
    The Kingdom of Denmark
    Posts
    2,702
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by redhillccwebmas
    Surely if a browser that someone is using has JS disabled, it would be a screen reader and nothing else?
    Or someone who is browsing with Javascript disabled.
    Christian Ankerstjerne
    <p<strong<abbr/HTML/ 4 teh win</>
    <>In Soviet Russia, website codes you!

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Common examples of "javascript disabled for some reason" may be someone viewing from behind a corporate firewall. I've heard tell of some firewalls which block all javascript, and some which block some javascript and allow other bits, meaning that you might even have a situation where javascript is partially disabled, so your noscript might not run, but your javascript might not work either.
    Jack Pickard | The Pickards

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Most browsers have a stylesheet switcher built in so that it is just a matter of coding all of the alternate styles in the HTML. Internet Explorer is the only browser that I know of where you would need to add any additional code to get it working.

    You don't need a stylesheet switcher if you are just trying to use different styles for different media as you can just set the media attribute for the different stylesheets that you want handheld devices, readers etc to use.

    If you write your HTML the way you want it for when JavaScript is not available and then use JavaScript to hide those elements that are not needed when it is enabled rather than using <noscript> then you can properly handle when it is partially disabled.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •