Re: controlling CSS load via JavaScript?

From: Rob Johnson <robj_at_uclink.berkeley.edu>
Date: Thu Jul 06 2006 - 12:22:11 PDT

Hi Kalle,

My preference is to use JavaScript only for not-functionally-required
feature enhancements -- that is, if someone turns off JS, their
choice won't break the site. It seems like what you suggest fits that
criteria, since the page would load anyway (if unsightly) if JS is
disabled.

However, have you considered doing this on the server side? If you
are using PHP or some other application framework, you may be able to
do this independently from JavaScript. For example, I am
conditionally delivering different style sheets based on browser
groups within ColdFusion, and could share my code if you think it
might be helpful.

Rob

_______________________________________________
Robert C. Johnson
Computer Operations & Information Services
robj@berkeley.edu
(510) 827-6834
_______________________________________________

Kalle Nemvalts writes (7/6/06 at 11:54 AM -0700) :
   (Concerning - [Webnet] controlling CSS load via JavaScript?) :

>I have a CSS stylesheet that works with current generation browsers
>but is unsightly (though still more or less functional) with Windows
>IE 5 and earlier.
>
>I'm thinking about using a JavaScript function to load the
>stylesheet conditionally, based on browser detection. It would load
>the CSS for all browsers except a short list of older browsers.
>(Exception detection might later be expanded to include PDAs, etc.)
>
>Without the CSS, the page would display linearly as plain HTML.
>
>However, any browser with JavaScript disabled would also not load the CSS.
>
>What's the current thinking on requiring JavaScript?
>
>Any suggestions for alternative ways to turn off CSS for older browsers?
>
>Thanks,
>
>Kalle
>
>Kalle Nemvalts
>IST Public Information
>2195 Hearst Ave 250-46 MC 3812
>kalle@berkeley.edu
>(510) 642-7582

-----------------------------------------------------------------------
The following was automatically added to this message by the list server:

Webnet information is available at http://webnet.berkeley.edu. Email sent to this list is archived at http://ls.berkeley.edu/mail/webnet/ . This archive is open to the general public and browsable by search engine spiders, email-address harvesting robots, your bosses, etc.
Received on Thu Jul 6 12:38:39 2006

This archive was generated by hypermail 2.1.8 : Thu Jul 06 2006 - 12:38:40 PDT