Using macros to define browser specific code

If you want to use a specific code for a specific browser you usually use a code like this (in this example we use IE6):

<!--[if lte IE 6]>html to be used just on IE 6<![endif]-->

Within the myShop.com templates this code will not work, the import module will not take up everything what is between <!-- and ->. To resolve this problem we created the extension myshop-macro-start/end, which will replace the condition tags. See this link too.

Below you will find examples of codes:

  • <meta name="myshop-macro-start" content="if IE"/>According to the conditional comment this is Internet Explorer<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if IE"/>According to the conditional comment this is not Internet Explorer<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if IE 5"/>According to the conditional comment this is Internet Explorer 5<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if IE 5.5"/>According to the conditional comment this is Internet Explorer 5.5<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if IE 7"/>According to the conditional comment this is Internet Explorer 7<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if gte IE 5"/>According to the conditional comment this is Internet Explorer 5 and up<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if lt IE 6"/>According to the conditional comment this is Internet Explorer lower than 6<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if lte IE 5.5"/>According to the conditional comment this is Internet Explorer lower or equal to 5.5<br /><meta name="myshop-macro-end" content="endif"/>
  • <meta name="myshop-macro-start" content="if gt IE 6"/>According to the conditional comment this is Internet Explorer greater than 6<br /><meta name="myshop-macro-end" content="endif"/>

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment