Problem

Problem

I have a problem with a module that does not changes size according to window width. So I have to try to find a solution and maybe metamod is the solution. Is there any way to get the screen/window size in a variable to show or not a module?

Re: Problem

Hi,

unfortunately there's no built-in way to do this with MetaMod, as MetaMod doesn't know about screen/window width. If you can make some JS code on your page that sets a cookie containing this information, then it is pretty easy to get MetaMod to pick this up from the cookie and use this to decide whether to include a module or not, or to switch which module it's going to include.

The only problem with this approach is that it won't and can't work on the very first page that the visitor requests. That's because:

1 - the client requests the page
2 - Joomla receives the request and generates the page
3 - the client receives the page and runs the JS -- and at this point the 1st page has already been sent and displayed, before the JS could discover the screen/window width
4 - the JS sets a cookie
5 - if/when the client requests the NEXT page, then the cookie will be sent to Joomla, and MetaMod would be able to pick it up and know the screen/window width.