Tips and Tricks: Legacy Browser Support

Aus CodeCoupler Wiki
Zur Navigation springen Zur Suche springen

In one of the early versions of CodeCoupler the library "HTML5 Boilerplate" in version 4 was used. There was the html-Tag surrounded with conditional statements for detecting older browsers. An interesting approach, but it was removed as of the version 5. Here is the complete discussion about this decission: https://github.com/h5bp/html5-boilerplate/issues/1290

For some, this approach may also be interesting:

<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="<?= $master_lang ?>"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang="<?= $master_lang ?>"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang="<?= $master_lang ?>"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="<?= $master_lang ?>"> <!--<![endif]-->

Now you can access the classes of the html-tag to detect the used browser. But the same thing can be imlemented with other libraries (e.g. modernizr), that do not mess up the html structure.