0

I have a problem that requires me to hide/change the actual window size of my browser from the web server. I mean the web server should learn wrong information about my actual agent window size. For instance, If my actual window size is X * Z, the server should read it as X/4 * Z/4. Is this possible?

Note: I do not want to use headless browsing or any other detectable technique. I just want my normal web browser to hide its actual windowsize information.

MKSOI
  • 49
  • 5
  • The browser does not send window size information to the server. – Rob Sep 09 '22 at 10:38
  • I don't think you can do that as the reported size is up to the browser itself. You would have to intercept any script that attempts to interrogate the browser for those values. Tor browser manipulates these values by restricting window sizes to large increments in an effort to reduce fingerprinting. 4x is a very specific amount – are you to trying to do mobile testing or something? Chrome (perhaps others) has display modes where you can emulate screen sizes that may do what you need. – Synchro Sep 09 '22 at 10:39
  • @Rob, thank you for your responce, however, I was refering to the ability of a web server to interrogate the browser about its window size. They usually do so for better user experiance. – MKSOI Sep 09 '22 at 11:18
  • @Synchro, thank you for your reponse. I am not trying to do mobile testing. I am just trying to fake the server to belive that I am using a different window size than what I actually use and see how it response. This should be done using any browser. For instance, can I configure Chrome or Firfox to reflect wrong window size to servers? Is there a batch or extension that can do so? – MKSOI Sep 09 '22 at 11:30

1 Answers1

2

The server can't interrogate the browser, but a script running in the browser can obtain those details and send them to the server. However, even then, you can't control what the browser does, even knowing that information. What you describe sounds just like the mobile testing modes in most browsers, and any script running those modes will report the "faked" screen size to the server via such scripts. In chrome, show dev tools, click this icon:

Show mobile emulation view button

Then at the top you can select different screen sizes, including a bunch or presets and orientations:

enter image description here

Any script running in that mode will report the emulated size.

Synchro
  • 35,538
  • 15
  • 81
  • 104
  • Thanks Synchro. I will try your way and get back to you. Now, if it succeeded, is there a way to automate it (e.g., via a script)? I mean can I run a script that configure Chrome or any other browser to reflect wrong window size? Regarding JS code, you can just ignore it for now. I have no problem with the server knowing that I am reflecting wrong window size. My server does not check this. – MKSOI Sep 09 '22 at 16:33
  • As others have said – your server *can't* check it, even if it wanted to. It delivers some HTML and CSS, and it's entirely up to your browser how it interprets that. It's still really unclear what it is you're trying to achieve. Also, you have no control over this screen size emulation capability. – Synchro Sep 10 '22 at 09:02