title: manipulate/change the window.screen property values
body: <p>Greetings dear community,</p>
  
  <p>my goal is to spoof the screen object properties, but I <strong>can not</strong> just overwrite the properties by using:
  <code>window.screen[property] = number;</code> or <code>Object.defineProperty(...)</code>
  because these properties are <strong>read-only</strong>.</p>
  
  <p>Therefore I wanted to kind of clone or recreate the screen object, manipulate the properties and then overwrite the whole window.screen object.</p>
  
  <p><strong>My attempt:</strong></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var clone = Object.create(Screen.prototype);
  Object.assign(clone, window.screen);
  console.log(clone);</code></pre>
  </div>
  </div>
  </p>
  
  <p>The prototype is cloning well but <strong>not the properties</strong>.
  After trying to get them with the <code>Object.getOwnPropertyNames</code> and <code>Object.keys</code> functions, which did not work either (<a href="https://codepen.io/anon/pen/VKpyrJ?editors=1010#0" rel="nofollow">example here</a>), they have to be in the prototype.
  So I tried this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var clone = Object.create(Screen.prototype);
  Object.assign(clone,Object.getPrototypeOf(window.screen));
  console.log(clone);</code></pre>
  </div>
  </div>
  </p>
  
  <p>which outputs the error <em>"TypeError: 'get availWidth' called on an object that does not implement interface Screen."</em></p>
  
  <p>Iterating with a for-in loop and assigning them does output the same error.</p>
  
  <p>So it seems like I have to implement the interface Screen, even though I'm not sure if my plan is working after that. Perhaps there exists a simpler solution.</p>
  
  <p><strong>Other ideas:</strong></p>
  
  <p>I could assign the complete screen object as prototype (like that <code>Object.create(screen)</code>) and then set own properties on the object, but then the original values are still readable.</p>
  
  <p>Maybe I also somehow can create an object by using <code>Screen(...)</code> interface?</p>
  
  <p>Thanks for your help and ideas!</p>