Reputation: 1211
Is it somehow possible in Magento to display content (on the home page) based on which browser the customer is using?
We got a fancy home page with css3 and js using. Works fine in all browsers (checked) but it won't work on the last browser, our client was mentioning, the Internet Explorer 8.
Unfortunately it's not possible for us to get the issues fixed by loading an ie.css file.
Our thought was, to detect the browser of the visiting customer and to display him an other home page or cms block.
Is this possible? Conditional Comments or in a phtml file?
Upvotes: 2
Views: 1301
Reputation: 2070
You can check this url to detect the browser , the condition can be placed in the required .phtml file . This URL could help How can I detect the browser with PHP or JavaScript?
Upvotes: 0
Reputation: 9100
The most elegant solution I can imagine for you is to create another theme inside of your package specially for those browsers. So if by default you have app/design/frontend/your_package/default
structure you have to create something like app/design/frontend/your_package/special_theme
which will inherit the default
theme of your package. Then in Admin\General\Design you can add an exception like on a screenshot below:
With the only exception that instead of iPhone|iPod|Blackberry..
you put matching pattern(s) of your browser's agent string and instead of iphone
your special_theme
name.
Screenshot is taken from magebase.com
Upvotes: 2
Reputation: 2480
The home page CMS entry hits 1column.phtml, 2columns-left.phtml etc depending on its configuration. These files are in your theme's directory. You have full control over what to display in those files, i.e.
<?php if( Mage::getSingleton('cms/page')->getIdentifier() == 'home' && preg_match('/(?i)msie 8/',$_SERVER['HTTP_USER_AGENT'])): ?>
Your content goes here.
<?php else: ?>
Display normal content
<?php endif; ?>
Upvotes: 1