That only loads the CSS file if the user DOESN'T have JS enabled. -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ricardojrm Sent: Thursday, September 13, 2007 9:46 AM To: jQuery (English) Subject: [jQuery] Re: Javascript best practices
<script type="text/javascript" src="path-to-file/thickbox.js"></ script> <noscript><link rel="stylesheet" href="path-to-file/thickbox.css" type="text/css" media="screen" /></noscript> It's work? On Sep 13, 7:55 am, Christof Donat <[EMAIL PROTECTED]> wrote: > Hi, > > > > > More & more plugins are using CSS to style the layout, this is good, > > but their didn't aware of if user browser don't know javascript, it > > is useless to load the CSS, e.g. thickbox > > > <script type="text/javascript" src="path-to-file/thickbox.js"></ > > script> > > <link rel="stylesheet" href="path-to-file/thickbox.css" type="text/ > > css" media="screen" /> > > > can be better: > > > <script type="text/javascript" src="path-to-file/thickbox.js"></ > > script> > > <script> > > document.write('<link rel="stylesheet" > > href="path-to-file/ thickbox.css" type="text/css" media="screen" > > />'); </script> > > Most userse do have JS active. The overall overhead in bytes > downloaded for thickbox.css where it is not needed is smaller than the > overhead of bytes you introduce with your additional script tag for > all users. In most cases it is better to load the unused stylesheet. > > Christof