Why are conditional comments implemented in IE?

less like so much of why the question is here ... I tried to find someone and could not find the answer I was looking for.

I am curious why conditional comments exist inside IE? Did Microsoft implement this in different versions of the browser because they knew they were not up to standard?

I know that a certain version of other browsers can be aimed at using conditional comments, and those for IE are much superior to any other browsers.

I would be interested to know any information about the origin and history of conditional comments.

+6
source share
1 answer

They implemented it using ie5 and saw that it was a good thing to optimize sites for IE.

Conditional comments have certain advantages over browser detection script methods.

  • Low impact on the client side.

When the lower-level browser detects a hidden conditional comment, the browser skips the HTML inside the comment, and the content elements are not parsed, loaded, or displayed. This saves the resources of the client computer.

  • No script.

Conditional comments do not require scripts and DHTML, and when a script is not used on a web page, there is no need to load the script. Conditional comments are processed at the stage of loading and parsing, therefore only content intended for the browser is downloaded. Conditional comments can be combined freely with other browser detection methods.

  • Separate code from detection logic.

Using conditional comments, script logic can be divided into smaller and simpler code segments that are easier to maintain and understand. In addition, code segments are only loaded by the version of the browser for which they were intended.

  • Cross browser

Conditional comments exist with Internet Explorer 5, but their use is not limited to Internet Explorer. Conditional comments can be used to customize content delivered to browsers that support conditional comments and those that do not.

Additional information: http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx

+2
source

Source: https://habr.com/ru/post/888277/


All Articles