I have found a script on the net that attaches a stylesheet to an .html document depending on the screen size of the user.
Exactly what i needed, but unfortunately, not working.
I've pasted it in the head of my html:
Is there anyone who can help me out getting this script to work?
Exactly what i needed, but unfortunately, not working.
I've pasted it in the head of my html:
Code:
var winW = 0, winH = 0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth-16;
winH = window.innerHeight-16;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
if (winW <= 1600) {
document.write('<link rel="stylesheet" type="text/css" href="1600.css">');
}
if (winW <= 1280) {
document.write('<link rel="stylesheet" type="text/css" href="1280.css">');
}
if (winW <= 1024) {
document.write('<link rel="stylesheet" type="text/css" href="1024.css">');
}
if (winW <= 800) {
document.write('<link rel="stylesheet" type="text/css" href="800.css">');
}
if (winW <= 640) {
document.write('<link rel="stylesheet" type="text/css" href="640.css">');
}
// End -->
</script>
Is there anyone who can help me out getting this script to work?