Why does the website's source code change when visited from different browsers?

Look at the bartzmall.pk source code from different browsers and you will see different classes added to the html tag for each browser.

From firefox

<html class="firefox firefox53 otherClasses">

      

From chrome

<html class="webkit chrome chrome58 otherClasses">

      

From IE

<html class="ie ie11 otherClasses">

      

And from the opera

<html class="webkit opera opera45 otherClasses">

      

The "otherClasses" class refers to 14 other classes that are common to all browsers.

How can this website change its source code when visited from different browsers? What is the purpose of these special browser-specific classes?

PS As a side question, what's the point / wisdom / reason for adding so many classes to the html tag?

+3


source to share


1 answer


There's a JS plugin called "modrnizer" (google it) that detects the type and capabilities of your browser and inserts the appropriate classes into your HTML tags, so you can customize CSS rules that respond to the specific differences between browsers using those classes.



The modrnizer site itself seems to be broken, but here is an article describing how it works: http://html5doctor.com/using-modernizr-to-detect-html5-features-and-provide-fallbacks/ p>

+6


source







All Articles