Different stylesheet for different browsers
Hi, How can I use one stylesheet for Netscape and older browsers and another for Mozilla, IE, Opera etc ? Is there an easy way to detect browser type and use a specified stylesheet for that browser? Preferrably not Zope specific, but perhaps javascript or CSS, I don't care. As long as its cross-browser it's ok. Best regards, Thomas Weholt
Just look at the HTTP-USERAGENT or somthing like that field in the REQUEST object... AM Thomas Weholt wrote:
Hi,
How can I use one stylesheet for Netscape and older browsers and another for Mozilla, IE, Opera etc ? Is there an easy way to detect browser type and use a specified stylesheet for that browser? Preferrably not Zope specific, but perhaps javascript or CSS, I don't care. As long as its cross-browser it's ok.
Best regards, Thomas Weholt
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
On Thu, Jun 27, 2002 at 11:50:47PM -0700, Aseem Mohanty wrote:
Just look at the HTTP-USERAGENT or somthing like that field in the REQUEST object...
Thomas Weholt wrote:
How can I use one stylesheet for Netscape and older browsers and another for Mozilla, IE, Opera etc ?
I use code like this at the beginning of a DTML Method that implements my CSS file: <dtml-call "RESPONSE.setHeader('Content-Type', 'text/css')"> <dtml-call "RESPONSE.setHeader('Last-Modified', bobobase_modification_time().toZone('GMT').rfc822())"> <dtml-call "RESPONSE.setHeader('Cache-Control','private, max-age=3600')"> <dtml-if "_.string.find(HTTP_USER_AGENT, 'MSIE') != -1"> <dtml-comment> Use smaller fonts for MSIE </dtml-comment> OL,UL,P,BODY,TD,TR,TH,FORM,.default { font-size: x-small; } .smaller, .footer { font-size: xx-small; } <dtml-else> OL,UL,P,BODY,TD,TR,TH,FORM,.default { font-size: small; } .smaller, .footer { font-size: x-small; } </dtml-if> The fixed part of the CSS file follows that. The first three lines are my quick&dirty hack to make the URL cacheable (done before Cache Manager became available). My code only calls out MSIE as a special case. You'd have to figure out the HTTP_USER_AGENT values that apply to the cases you want to discriminate. -- Fred Yankowski fred@ontosys.com tel: +1.630.879.1312 OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370 www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
try usersniffer.py http://www.zope.org/Members/svenasse/UserSniffer /wolfie
Hi,
How can I use one stylesheet for Netscape and older browsers and another for Mozilla, IE, Opera etc ? Is there an easy way to detect browser type and use a specified stylesheet for that browser? Preferrably not Zope specific, but perhaps javascript or CSS, I don't care. As long as its cross-browser it's ok.
Best regards, Thomas Weholt
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
Thomas Weholt wrote:
How can I use one stylesheet for Netscape and older browsers and another for Mozilla, IE, Opera etc ? Is there an easy way to detect browser type and use a specified stylesheet for that browser? Preferrably not Zope specific, but perhaps javascript or CSS, I don't care. As long as its cross-browser it's ok.
A little bit late perhaps: As the CSS support in recent browsers is rather good, it might be sufficient to have a special stylesheet for Netscape 4. The standard trick is is using a css @import statement for recent browsers, which NS4 simply ignores. Btw, look at plone.org for really cool Zope and css side. Regards MFvM
participants (5)
-
Aseem Mohanty -
fred@ontosys.com -
Michael Fischer v. Mollard -
Thomas Weholt -
wchr@gmx.at