Browsing articles tagged with "handy code Archives - MetaFlood"
Oct
23
2011

Use jQuery and Modernizr to load javascript conditionally, based on existence of DOM element

In the past year or so, Modernizr has really exploded on the web development scene. It allows the detection of browser abilities, such as geolocation, canvas, etc. Version 2 also merged with yepnope.js which allows for the conditional loading of CSS & JS. If you don’t know what Modernizr is, their site provides lots of clear documentation to show you its’ power. The one thing that wasn’t clear to me, was if I could load […]

May
14
2011

Super simple Javascript User Agent detection

I recently had the need to detect some mobile User Agents. If you’re not familiar with the topic, a User Agent is a piece of information that’s in every browser, desktop or mobile, which basically gives some data about it’s vendor and version. So you would be able to tell if a site visitor was using Firefox 4, Internet Explorer 8, or was on an iPhone for example. There are some very robust and complex […]