Stop Firefox Dpi Scaling (When Windows Setting Is at 125%)

Browser is scaling page to 125%

Finally I found an answer.

For Firefox:
https://stackoverflow.com/a/24958483/6552578

Chrome:
https://productforums.google.com/forum/#!topic/chrome/_jmREHlt3ZE

Solution - need to edit desktop link to Chrome like that:

"C:\Program Files\Google\Chrome\Application\chrome.exe"  /force-device-scale-factor=1

Force Zoom-Level/DPI-Scale with CSS, Header-Tag or JavaScript

You can check the browser dpi level with javascript and zoom the page contents accordingly with css(if needed).

if(window.devicePixelRatio == 1 )
$("body").addClass("zoom2x")

Where zoom2x is a css class.

.zoom2x{
zoom: 200%; /* all browsers */
-moz-transform: scale(2); /* Firefox */
}

You may crosscheck your current dpi setting here and verify results.

Change windows dpi setting C#

You can do this by modifying the registry value of the registry key HKEY_CURRENT_USER\Control Panel\Desktop:LogPixels. The type is REG_DWORD.

You can see the Registry methods here to help how to modify the registry values.

Setting the value to 96 (0x60) corresponds setting the DPI settings to "Smaller" (100%).

  • 96 is "Smaller" (100%),
  • 120 is "Medium" (125%),
  • 144 is "Larger" (150%).

Note that the computer may still require a reboot or logout/login to make everything work as expected with that setting.



Related Topics



Leave a reply



Submit