In order to provide full quality in a canvas I wanted to use the actual amount of pixel the canvas will be using on the screen. The content of the webpage I am coding for is fixed to 465px. But you can Imagine, a canvas with 465px is not very nice. And since modern monitors have way more pixel, I thought I could use this to my advantage. I tried different things like innderWidth, clientWidth and normal width but nothing worked. I really need a function that changes when I reload the browser with a different zoom.
HTML:
<div id="myTargetDiv"></div>
Javascript:
<script>
$("#myTargetDiv").html("<canvas id='myCanvas' style='widt: 100%" width="
+ document.getElementById("contentMain").clientWidth + "' height='"
+ document.getElementById("contentMain").clientheight
+ "'>Your Browser does not support the HTML5 canvas tag</canvas>");
</script>
I'd be glad if you could provide a solution in JS or in Jquery