Swap out design asset


(Ryan Archer) #1

Is it possible to perform browser sniffing in Squiz Matrix and 'swap' out the design asset file based on the type of browser viewing the website?

The reason we are looking for this feature is that we have to support IE8 still (groans*).

 

We are using a Megamenu framework from "CodyHouse" and it only supports IE9+ because of the CSS and SVG within it. What we want to do is use a different design file with a different menu system in it if a computer using IE8 views the website pages.

 

I will cherish the day when they finally kill IE.


(Nic Hubbard) #2

You could use the design show_if that has the user agent condition:

 

http://manuals.matrix.squizsuite.net/designs/chapters/show-if-design-area#user-agent


(Ryan Archer) #3

mmm sounds great. Replace the MySource menu with another (i.e. swap the print from NO to YES, dependant on the outcome). Only issue is that I have no idea what the RegEx is to detect IE8.

 

Heck, I can't even get Squiz Matrix to detect any version of IE I am using. The MSIE on its own will now work.


(Ryan Archer) #4

I am even trying to use conditional expressions but that doesn't seem to be working for complex HTML either let alone a Squiz Printed menu https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx


(Ryan Archer) #5

Hey @ Squiz Staff

Can you please tell us the Regular Expression for detecting IE8?

 

I have gone to this manual http://manuals.matrix.squizsuite.net/designs/chapters/show-if-design-area#user-agent

and even tried using the MSIE which is an example given - this fails to work on either IE11 or IE8 (running on a simulator)


(Nic Hubbard) #6

and even tried using the MSIE which is an example given - this fails to work on either IE11 or IE8 (running on a simulator)

 

Remember that the User Agent can easily be faked, so are you sure that the Simulator is returning the correct IE User Agent?

 

Check: http://whatsmyuseragent.com


(Ryan Archer) #7

We are using VirtualBox to test old versions of IE so I suppose we are faking it (I mean it's actually hard to find a real copy of IE8 these days!).

In the end we are going with MSIE which targets 8,9 & 10. IE11 uses Trident so it won't work for that anyway - which is actually a good thing because I would prefer if IE11 serves up the 'modern' content. Don't really care much for IE 8,9 & 10 anyhow - let them eat cake.

 

Shame could not target a particular version of the user agent but that's the compromise. 


(Bart Banda) #8

A quick Google gave me a way to do it inJS for IE6 or 7, maybe you could use that and tweak it for IE8? 

http://stackoverflow.com/questions/10596813/how-to-detect-ie7-by-the-user-agent-string-leaving-out-newer-ie-versions-runnin

http://stackoverflow.com/questions/7414968/regex-to-check-ie-version

 

Alternatively, you might be better off just using client side JS and CSS and hiding/showing stuff for IE8 users using the <!--[if IE 8]> method.