Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.



Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.


Redirect recepie with timed cookie

Redirect recepie with timed cookie


I'm using MetaMod recipe to redirect to another page. There is timed cookie as well, so I adjust the time how often the users should get redirected.

The code of the recipe is the following:

$app = &JFactory::getApplication();
$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+900, '/' );

Joomla version: 2.5.17
Metamod version: 3.15

The problem I am facing is that this does not work on iPhone/safari (didn't test for other mobile devices). The user sees the redirect code all the time, as if the cookie is not present.

I have two questions regarding this:

1. Is there a way this recipe to work on mobile devices as well?
2. Is there a way to EXCLUDE all mobile devices, so this code won't apply to them at all?


Beginner Modder
1 Posts
Administrator has disabled public posting

Re: Redirect recepie with timed cookie

Hi Igor,

I've just done some research on this, and tested on some different browsers:

Android browser: no problem
Safari/Mac: problem
Firefox/Mac: no problem
Safari/iOS7: problem.

Someone else complaining about it on iOS:

The issue appears to be that the 303 response is being cached, but is not supposed to be according to the standard. The cookie is in fact being set and you can see that by going to another URL on the same site, which this time does NOT redirect.

In Safari/Mac you can clear the cache, and after doing this the redirect stops taking effect. That's why I am sure it's a caching problem in Safari (or probably WebKit).

I don't know of a fix for this at this time. Perhaps there may be alternative ways to do a redirect e.g. instead of $app->redirect() above, you may have better success doing a JS redirect or meta refresh. Sorry I can't help much more there apart from pointing you in those directions to explore.

Best regards,

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

3330 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
Total Topics:
Total Polls:
Total Posts:
Posts this week:
User Info:
Total Users:
Newest User:
Members Online:
Guests Online:

There are no members online

Forum Legend:

 New Sticky