From 5daca37f5cb1d72c50c397780b3d89d146af64c1 Mon Sep 17 00:00:00 2001 From: Sheng Date: Sat, 22 Jun 2019 13:35:30 +0800 Subject: [PATCH] Edge doesn't support document fonts --- webssh/static/js/main.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/webssh/static/js/main.js b/webssh/static/js/main.js index 75b76ac..8b0bf73 100644 --- a/webssh/static/js/main.js +++ b/webssh/static/js/main.js @@ -43,7 +43,7 @@ jQuery(function($){ title_element = document.querySelector('title'), form_id = '#connect', debug = document.querySelector(form_id).noValidate, - custom_font = document.fonts.values().next().value, + custom_font = document.fonts ? document.fonts.values().next().value : undefined, default_fonts, DISCONNECTED = 0, CONNECTING = 1, @@ -739,13 +739,15 @@ jQuery(function($){ window.Terminal.applyAddon(window.fullscreen); } - document.fonts.ready.then( - function () { - if (custom_font_is_loaded() === false) { - document.body.style.fontFamily = custom_font.family; + if (document.fonts) { + document.fonts.ready.then( + function () { + if (custom_font_is_loaded() === false) { + document.body.style.fontFamily = custom_font.family; + } } - } - ); + ); + } restore_items(fields);