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

client-side rewrite: fix window.devicePixelRatio to 1 to ensure consistent replay (esp for video)

This commit is contained in:
Ilya Kreymer 2017-08-10 16:13:17 -07:00
parent c6d196c9fe
commit ce3ba9e42e
2 changed files with 12 additions and 2 deletions

View File

@ -717,7 +717,15 @@ var _WBWombat = function($wbwindow, wbinfo) {
$wbwindow.Crypto.prototype.getRandomValues = new_getrandom;
$wbwindow.crypto.getRandomValues = new_getrandom;
}
}
//============================================
function init_fixed_ratio() {
if (Object.defineProperty) {
// fixed pix ratio
Object.defineProperty($wbwindow, "devicePixelRatio", {value: 1, configurable: false});
}
}
//============================================
function override_history_func(func_name) {
@ -2850,6 +2858,9 @@ var _WBWombat = function($wbwindow, wbinfo) {
// Crypto Random
init_crypto_random();
// set fixed pixel ratio
init_fixed_ratio();
// Date
init_date_override(wbinfo.wombat_sec);

View File

@ -34,7 +34,6 @@
{% endif %}
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.js'> </script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/vidrw.js'> </script>
{% include banner_html ignore missing %}