From 9fdff8388e7cd82ab2c53f22865147562819f411 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 10 Aug 2017 16:36:29 -0700 Subject: [PATCH] client-side override fix: first set window.devicePixelRatio to 1, also prevent from changing, if possible (catch exception) --- pywb/static/wombat.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js index ab2dac4c..ee4780eb 100644 --- a/pywb/static/wombat.js +++ b/pywb/static/wombat.js @@ -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) { } } }