Following this previous question JQuery distinct between smartphones, tablet or computers with different sizes but the same $(window).width() I now that I know the real sizes from the devices I use thank to window.screen.width , I would like to use one CSS file or another depending of this size, like for example:
<script>
var w = window.screen.width;
if(w < 800){
//I should include somehow this <link href="{{ asset('assets/css/firstCSS.css') }}" type="text/css" rel="stylesheet">
} else {
//Adding the second CSS file... <link href="{{ asset('assets/css/secondCSS.css') }}" type="text/css" rel="stylesheet">
}
</script>
I know this code looks horrible but I'm not able to get a solution.
(Edited)It is possible to use a css file depending on a value from JavaScript? Don't answer me yes... and show me how please.