I have a problem trying to adjust my HTML body and footer with a width that’s as wide as the user’s screen. On many sites they say document.body.clientWidth is the users screenwidth minus toolbars, etc. But this apears to be wrong because i have a screenwidth of 1024 and as you can see below i made a test environment wich indicates that the usable screenwidth is 1366 so my website is far to wide..
Many thanks
HTML :
<body id="body" onload="init();">
<p id="screenwidth">0</p>
<div id="footer">
<div class="ruimte"></div>
</div>
</body>
functies.js :
function init(){
document.body.style.width = document.body.clientWidth + "px";
document.getElementById("footer").style.width = document.body.clientWidth + "px";
document.getElementById("screenwidth").innerHTML = document.body.clientWidth;
}
I just used your exact code and
document.body.clientWidthworked fine for me (gave the correct width 1024) in a bunch of different browsers.