Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod Favourite Recipes
- » Screen size / resolution option
Screen size / resolution option
Re: Screen size / resolution option
Yes and no. No, there's no built-in option to do it, and no, it's not easy to achieve. But Yes, it may be possible.
The basic problem is that browsers do not send the screen size and/or resolution to the web server when they send a normal HTTP request.
This means that the first response from the server to browser cannot respond to screen size/resolution.
If however you put some JavaScript onto the first (or any) page that the browser accesses in a session, then that JS could "call home" with AJAX, with more information about the browser or screen dimensions. The Ajax call could put the info into a session variable ready for the next page that gets generated.
Using this information, or if it's then in a cookie, then the next page generated has the information available and could make decisions using it.
Unfortunately there are some key problems left here:
1 - the "first page" problem. The first page generated in a session does not have dimension information. It simply can't have it.
2 - in an attempt to get around the "first page" problem, you might decide to make the 1st page do an automatic refresh, with the screen dimensions set in a cookie or sent back to the server in Ajax or post/get variable. However this comes with significant problems of its own:
- if the client does not have javascript and/or cookies enabled, then the server can't tell the difference between the page refresh and a brand new page request. The server may not be able to store anything in a session if cookies are disabled.
- Or the page may not refresh at all (no JS).
- Or searchbots are unable to index the page because they can't perform the requested refresh.
If anyone has any ingenious ways to work around these limitations then I'd be delighted to hear about them, and this would open the door to even more Chameleon conditions based on browser capabilities.
Best regards,
Stephen
Re: Screen size / resolution option
Media queries have direct access to various media capabilities. JS has the same access, I think. Both CSS and JS are client-side however, so if you need the server to act on them then you need a way for the client to communicate back to the server. This is normally done via cookies (so the data is sent with the next request), or via AJAX.
- Index
- » MetaMod
- » MetaMod Favourite Recipes
- » Screen size / resolution option
Board Info
- Board Stats:
- Total Topics:
- 1698
- Total Polls:
- 6
- Total Posts:
- 5944
- Posts this week:
- 4
- User Info:
- Total Users:
- 5534
- Newest User:
- kaylee
- Members Online:
- 0
- Guests Online:
- 86
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked