Skip to main content

A helper Plone extension which makes easier to include resources specific to several types of browsers or platforms.

Project description


A helper Plone extension which makes easier to include resources like CSS, JS, KSS or HTML specific to different types of browsers or platforms.


This package requires Plone 3.x or later (should work with 2.5.x also).

Installing without buildout

Install this package in either your system path packages or in the lib/python directory of your Zope instance. You can do this using either easy_install or via the script.

After installing the package it needs to be registered in your Zope instance. This can be done by putting a collective.browserdetector-configure.zcml file in the etc/package-includes directory with this content:

<include package="collective.browserdetector" />

or, alternatively, you can add that line to the configure.zcml in a package or Product that is already registered.

Installing with buildout

If you are using buildout to manage your instance installing collective.browserdetector is even simpler. You can install collective.browserdetector by adding it to the eggs line for your instance:

eggs = collective.browserdetector
zcml = collective.browserdetector

The last line tells buildout to generate a zcml snippet that tells Zope to configure collective.browserdetector.

If another package depends on the collective.browserdetector egg or includes its zcml directly you do not need to specify anything in the buildout configuration: buildout will detect this automatically.

After updating the configuration you need to run the ‘’bin/buildout’’, which will take care of updating your system.


There are several browsers, mostly older releases, which renders websites in different way then common browsers of latest versions. So in case you need to support these browsers with your website, one possible way how to include fixes for their different behaviour is to include individual resources targeting specific browsers.

Plone by default includes IEFixes.css file (with a few others) where are fixes / hacks related to all IE browsers for example, but what if you need different fixes for each IE version? There comes collective.browserdetector in turn.

1. Lazy way (quick & start)

  • install browser detector via Quick Installer

  • go to ZMI:/portal_skins/collective.browserdetector

  • select css module for your browser (by its name) and customize it

  • add your css hacks into customized css file

  • go to ZMI:/portal_css and register your new resource, see example of generic setup configuration::

    <stylesheet title=""
        id="IE6.css" media="screen" rel="stylesheet" rendering="import"
        cacheable="True" compression="safe" cookable="True" enabled="1"
  • don’t forget to set the right expression, but don’t worry the only thing which you have to take care is its last part “isIE6” in this example, you should use the right detector attribute according to targeting browser (list of available detector attributes is included below)

And that’s it.

2. Using policy or theme

  • register collective.browserdetector as dependency of your policy package (in the metadata.xml profile module)
  • include your css files with fixes in the skin layers (you can copy prepared css files from collective.browserdetector/collective/browserdetector/skins/collective.browserdetector)
  • register your css files via generic setup (see collective.browserdetector/collective/browserdetector/profiles/default/cssregistry.xml.example for an example)

And that’s it.

3. Detector attributes

Here are available detector attributes usable for conditions::

isSecure, isWebKit, isOpera, isChrome, isSafari, isSafari3,
isSafari4, isIE, isIE7, isIE8, isIE6, isGecko, isGecko3,
isGecko2, isFirefox, isFirefox1, isFirefox2, isFirefox3,
isWindows, isMac, isLinux, isSafariOnMac, isSafariOnWin,
isGeckoOnMac, isGeckoOnLinux, isGeckoOnWin, isFirefoxOnMac,
isFirefoxOnLinux, isFirefoxOnWin, isOperaOnMac,
isOperaOnLinux, isOperaOnWin, isChromeOnMac, isChromeOnLinux,

For more information see module.

4. Tips

  • you can use detector conditions for kss and javascript resources also

  • you can use detector in templates to render different (X)HTML depending on browser/platform for example::

    <tal:block define="detector nocall:context/browser-detector">
        <tal:firefox condition="detector/isFirefox">
        <tal:ie condition="detector/isIE">

Additionally you can display browser detection information in the browser detector portlet. Go to portlets management page (@@manage-portlets) and add new portlet “Browser Detector”. Portlet also has a link (in the footer) to browser view displaying results of each detection methods.


1.1.2 - (2009-08-20)

  • fixed broken package by missing manifest file [lzdych]

1.1 - (2009-07-08)

  • removed content providers and editable border from the detection view [lzdych]
  • fixed mistate in the README example using detector in templates [lzdych]
  • added explicit condition attributes related to Firefox browser [lzdych]
  • added firefox related stylesheet templates [lzdych]

1.0 - (2009-06-16)

  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for collective.browserdetector, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size (49.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page