简体   繁体   中英

How to load a different .phtml file if a specific condition is met in magento?

I am currently using a .phtml file for a specific page which works well in all modern browsers in magento. But it is not properly rendered in IE6, IE7. Is there a way in magento by which I can load a different .phtml file from the .xml file if it is an old browser, instead of writing an if condition inside my .phtml page ? Also, Is there any other method through which a different .phtml can be loaded ?

Browser detection is done client side AFTER the page has been delivered, which means that the server doesn't know what browser the user will have until after the .phtml files have been run and delivered. You can do this as an ajax call, but it would be a little weird to do that in Magento for a full page.

Honestly... its 2015, the percentage of people using IE6/7 is so low, and those people probably aren't making purchases anyway, you would probably just be safe delivering a message at the top of the screen that says "update your browser for a full experience" and this can be done in either CSS or JS with simple browser detection.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM