I often find myself wanting to do something in the web browser when I'm developing a site, but not when it is in production. For example, I don't want our development team polluting Google Analytics data, and I only want to log errors while the site is in local development or in our staging environment but not in production.
We'll need 4 functions:
- Check for URL parameters.
- Check for a cookie.
- Set a cookie.
- Set devmode.
Checkout the sample web site code:
PAGE.devmode() which accepts a boolean that will set the devmode if
Notice how we check for the 'devmode' cookie or 'devmode' URL parameter in the
Anyway, I've found this way of controlling browser mode so useful that I almost always include it in all my projects.