This extension adds user screen information to the symphony param pool for server-side optimizations for responsive web design.
Add as a submodulegit submodule add https://github.com/thebestsophist/Screen_Detection.git extensions/Screen_Detection --recursive
This extension adds fields for the user agent's browser window properties to the param pool so you can deliver optimized media sizes in responsive layouts similar to https://github.com/filamentgroup/Responsive-Images.
- jQuery (though you could get around it if you wanted)
- Modernizr (optional)
- Add the folder to your extensions folder.
- Enable the extension in
System -> extensions
- Add the text of js/plugin.js to your scripts.
- You're done!.
How it works
js/plugin.js polls the width of the window and the screen whenever the browser is resized and saves the sizes to six cookies:
pixel-density which are added to your param pool at the next page request. From there you can use them to set choose-when-otherwise conditions to deliver optimized media and code for paticular screen properties.
(Note: If you are not already using jQuery you should probably use another methods to set your cookies such as http://stackoverflow.com/a/8876069)
Why keep polling for changes?
While most users do not constantly change their browser and screen sizes, some do. This is especially important for users who plug their notebooks into external monitors and projectors.
Why not just use screen width?
While the maximum screen width is useful for figuring out the largest possible size people use, those with giant screens rarely set their browser windows to full width. This means that sending really large media is unnecessary and takes up bandwidth.
How you (probably) shouldn't use this extension.
While this extension (sort of) gives you the ability to deliver content based on device, you should not use it to dumb down your content for smaller devices. Instead, build your design and content around mobile-first principles and work your way up to larger screens.
Released under MIT, just like Symphony CMS. Share and enjoy!
Symphony 2.2.3 to 2.3.x
- Updating broken extension id (per http://www.getsymphony.com/discuss/thread/103681/1/#position-5)
Symphony 2.2.3 to 2.3
- Added version requirements. No functional changes.