W
W
weranda2016-04-25 21:55:17
JavaScript
weranda, 2016-04-25 21:55:17

How to maximally cross-browser separate the call of scripts and styles in browsers depending on the browser?

I welcome
As a matter of fact the task is simple, but got confused in various variants of implementation. How to separate the call of scripts and styles depending on the browser? Only two conditions are needed:
1) if the browser is ie8 or a version less, then we load only these files (styles, scripts)
2) if it is any browser other than ie8 or a version less, then only these files (styles, scripts) are loaded.

if ie8 or lower:
    style-ie.css
    script-ie.js
else:
    style-normal.css
    script-normal.js

Just confused. If you use this, then visually the code does not like:
<!--[if lt IE 9]>
  <link rel="stylesheet" type="text/css" href="style-ie.css" />
<![endif]-->

If you use JS, then I don’t know which option is more reliable, easier ...
If you use third-party libraries, then many of them are redundant (some, as it turned out, are shamelessly outdated or unsupported) and with tricks for me due to ignorance of JS.
Advise a proven option for this case, if possible, then with a specific example.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Inchin ☢, 2016-04-26
@weranda

There is nothing cooler than conditional IE comments :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question