I'm trying to use inline svgs for a number of logos and icons, and I was considering adding the inline svg code in a preprocess function. This seems like a good place to check for svg support (namely, whether or not it's IE8) and provide a png if needed.
Are there any native Drupal functions available to check for this in a preprocess function? Or should I instead rely on a regex match using
I tried to search here - https://api.drupal.org/api/drupal/functions - but didn't have any luck, so any suggestions or links to other resources would be much appreciated!
Edit: To clarify on what I mean by 'inline svg code' - I want to use actual
<path> tags, not
<img src="example.svg" /> to allow for greater styling control with CSS.
@AyeshK - I agree that there are many pitfalls in user-agent and feature detection, mainly related to keeping an up-to-date library of user-agents and features. In this specific case, SVG seems to have broad support moving forward, and I'd like to only serve the png version of images to those few browsers (within our support matrix) who don't support it, avoiding additional HTTP requests for the many browsers that do. The idea of putting this on the server side comes from Adaptive Web Design / Responsive Design on Server Side (RESS).