1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 08:04:49 +01:00

client-side override fix: first set window.devicePixelRatio to 1, also prevent from changing, if possible (catch exception)

This commit is contained in:
Ilya Kreymer 2017-08-10 16:36:29 -07:00
parent ce3ba9e42e
commit 9fdff8388e

View File

@ -721,9 +721,15 @@ var _WBWombat = function($wbwindow, wbinfo) {
//============================================
function init_fixed_ratio() {
// otherwise, just set it
$wbwindow.devicePixelRatio = 1;
// prevent changing, if possible
if (Object.defineProperty) {
// fixed pix ratio
Object.defineProperty($wbwindow, "devicePixelRatio", {value: 1, configurable: false});
try {
// fixed pix ratio
Object.defineProperty($wbwindow, "devicePixelRatio", {value: 1, writable: false});
} catch (e) { }
}
}