I have a pretty simple HTML code that displays browsers current working area:
<html>
<head>
</head>
<body>
<script type="text/javascript">
wwidth = document.body.clientWidth;
wheight = document.body.clientHeight;
alert("Working area is: " + wwidth + "x" + wheight);
</script>
</body>
</html>
I am trying to tamper these values with my own ones using the following Greasemonkey script (I have used the following topic as a reference) which does not seem to work:
// ==UserScript==
// @name Resolution
// @namespace One
// @include *
// @version 1
// @grant none
// ==/UserScript==
function main () {
Object.defineProperty(body, "clientWidth", {value: '1000'});
Object.defineProperty(body, "clientHeight", {value: '1000'});
}
var script = document.createElement('script');
script.appendChild(document.createTextNode('('+ main +')();'));
(document.body || document.head ||document.documentElement).appendChild(script);
This is my first work with javascript and some may find this to be a pretty simple issue but I simply can not find a solution to it so any help would be really appreciated.
Thank you in advance!