I am trying to set screen dispositive width for a div using JS, using the following line:
var cont = document.getElementById("content");
cont.style.width = (screen.width * 0.93)+"px";
You can use window.devicePixelRatio as a modifier (at least sometimes)* **
console.log(window.devicePixelRatio * screen.width)
*There is a problem here in how the browser interprets the screen width when zoomed. I ran a quick test with FF, IE and Chrome and while FF and IE are giving the result you describe, Chrome always displays the same width... which means this doesn't work in Chrome (at least).
**I also have no idea of the browser compatibility, it is in working draft status. It seemed to work on the modern browsers I tested at least.