HOWTO: Disable all cookies for normal visitors in Joomla 1.0.12
Posted: Sun Feb 25, 2007 10:23 pm
Problem:
Joomla excessively utilizes session cookies for user tracking, hit counting, statistics and more. This can upset cookie-aware users and therefore undermine your credibility, especially if you're running sites promoting data thriftiness (sounds awful in English... "Datensparsamkeit" in German - does anyone know a better translation? :) )
Following I will describe how to avoid all cookies for normal visitors and still have front end login. (Works with version 1.0.12 - no guaranty for older ones and definitely not for v1.5!)
- First of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No
This will stop the "mosvisitor" cookie.
- Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
- Be careful with components: Some might start their own PHP session. (And I just don't get why 1 session isn't enough...) Fabrik is such a case.
- Now to the main point:
Delete / comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
Because of a set POST/GET parameter named "force_session", a user session will be started anyway in the code further down if someone logs in. This parameter is set in the standard login module. If you use your own login module, just add this parameter!
- Additional: Comment out line 25 in /offline.php: // session_start();
This seams to be an artifact of old versions. It really doesn't make sense to me, to start a PHP session in this file, particularly because Joomla uses its own session mechanism...
Maybe this information is useful to some other people like me.
It would be interesting to hear from a developer, what lead to the decision to start a session (and therefore set a cookie) on first page call for every user. And additionally, why it is so easy to remove that behavior - or in other words: why is a different behavior implemented almost to the end? All whats missing is a configuration flag...
Have a nice day,
tla.designz
Joomla excessively utilizes session cookies for user tracking, hit counting, statistics and more. This can upset cookie-aware users and therefore undermine your credibility, especially if you're running sites promoting data thriftiness (sounds awful in English... "Datensparsamkeit" in German - does anyone know a better translation? :) )
Following I will describe how to avoid all cookies for normal visitors and still have front end login. (Works with version 1.0.12 - no guaranty for older ones and definitely not for v1.5!)
- First of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No
This will stop the "mosvisitor" cookie.
- Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
- Be careful with components: Some might start their own PHP session. (And I just don't get why 1 session isn't enough...) Fabrik is such a case.
- Now to the main point:
Delete / comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
Because of a set POST/GET parameter named "force_session", a user session will be started anyway in the code further down if someone logs in. This parameter is set in the standard login module. If you use your own login module, just add this parameter!
- Additional: Comment out line 25 in /offline.php: // session_start();
This seams to be an artifact of old versions. It really doesn't make sense to me, to start a PHP session in this file, particularly because Joomla uses its own session mechanism...
Maybe this information is useful to some other people like me.
It would be interesting to hear from a developer, what lead to the decision to start a session (and therefore set a cookie) on first page call for every user. And additionally, why it is so easy to remove that behavior - or in other words: why is a different behavior implemented almost to the end? All whats missing is a configuration flag...
Have a nice day,
tla.designz