M
M
Mithgol2011-07-18 10:26:06
css
Mithgol, 2011-07-18 10:26:06

Until when to use createStyleSheet()? In which version of Internet Explorer does a simple hyperlink to a style file work?

As you know, in earlier versions of Internet Explorer, you had to use the proprietary createStyleSheet( ) method to embed a style sheet in a document. Some of these versions are still in use, which is why websites have to use a conditional statement like the following to insert styles dynamically (performed by javascript):

if (document.createStyleSheet) {
   document.createStyleSheet(sheetPath); // Internet Explorer
} else {
   $('head').append('<link rel="stylesheet" type="text/css" href="' + sheetPath + '" />');
}

The question is: has a version of IE finally come out in which the normal sticking of a link ( <link> ) works permissively, so that it will be possible to completely abandon createStyleSheet() after this version of IE completely wins the market from all its predecessors?
(Before turning to Habrahabr, I hoped to find a satisfactory answer to this question on quirksmode.org - but, alas, even this problem itself is not mentioned there.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Beloglazov, 2011-07-19
@Mithgol

It definitely works in IE 9. Just checked ;)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question