Question

I am new to require.js. I am using html5shiv for IE polyfill, which execute only in IE.

Now, how to define IE specific condition in require.config ?

require.config({
  paths: {
    jquery: 'libs/jquery',
    html5shiv : 'libs/html5shiv'
  }
});

html5shiv should get loaded only in IE

Was it helpful?

Solution 2

late to the party perhaps, but you can use bowser its already amd-ready

require(['bowser'],function(bowser){
    if (bowser.msie && bowser.version < 9) {
        //include your html5shiv/shim/modernizr here
    }
});

best of luck!

OTHER TIPS

The HTML5shiv code needs to happen in the <head> and if you use some other means to load html5shiv.js its built in shim code won't get called in time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top