jeudi 28 septembre 2023

spoof randomly screen resolution at every browser startup (javascript - violentmonkey)

I want to randomly execute a bunch of strings within the same script.

I'd like to run it randomly so that I get a different screen resolution every time I start the browser, instead of being stuck at 1920*1080 for example.

(I'm using violentmonkey by the way) Thanks.

Run it (1920×1080) Object.defineProperty(window.screen, "availWidth", { get: function(){return 1920; }}); Object.defineProperty(window.screen, "width", { get: function(){return 1920; }});

Object.defineProperty(window.screen, "availHeight", { get: function(){return 1080; }}); Object.defineProperty(window.screen, "height", { get: function(){return 1080; }});

Object.defineProperty(window, "innerWidth", { get: function(){return 1920; }}); Object.defineProperty(window, "innerHeight", { get: function(){return 974; }});

Object.defineProperty(window, "outerWidth", { get: function(){return 1920; }}); Object.defineProperty(window, "outerHeight", { get: function(){return 1040; }});

Object.defineProperty(window, "devicePixelRatio", { get: function(){return 1; }});

or this one (could be 2560 x 1440) Object.defineProperty(window.screen, "availWidth", { get: function(){return ; }}); Object.defineProperty(window.screen, "width", { get: function(){return ; }});

Object.defineProperty(window.screen, "availHeight", { get: function(){return ; }}); Object.defineProperty(window.screen, "height", { get: function(){return ; }});

Object.defineProperty(window, "innerWidth", { get: function(){return ; }}); Object.defineProperty(window, "innerHeight", { get: function(){return ; }});

Object.defineProperty(window, "outerWidth", { get: function(){return ; }}); Object.defineProperty(window, "outerHeight", { get: function(){return ; }});

Object.defineProperty(window, "devicePixelRatio", { get: function(){return ; }});

or that one... (could be 1280 x 720) Object.defineProperty(window.screen, "availWidth", { get: function(){return ; }}); Object.defineProperty(window.screen, "width", { get: function(){return ; }});

Object.defineProperty(window.screen, "availHeight", { get: function(){return ; }}); Object.defineProperty(window.screen, "height", { get: function(){return ; }});

Object.defineProperty(window, "innerWidth", { get: function(){return ; }}); Object.defineProperty(window, "innerHeight", { get: function(){return ; }});

Object.defineProperty(window, "outerWidth", { get: function(){return ; }}); Object.defineProperty(window, "outerHeight", { get: function(){return ; }});

Object.defineProperty(window, "devicePixelRatio", { get: function(){return ; }});

I haven't tried anything, even though I've spent hours trying to find a way to do it.




Aucun commentaire:

Enregistrer un commentaire