diff options
| author | Lex Neva <github.com@lexneva.name> | 2018-04-18 22:30:26 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2018-04-18 22:30:26 -0400 |
| commit | dc547108e1d85c2dd241d329e0858dced90bf92c (patch) | |
| tree | 01d2b1530c426d71a80aac9393cb93f58aafc962 /print/resources | |
| parent | aea5919c63796efd748d724752a86773b79b7c3b (diff) | |
handle firefox's window.close() permission denied
Diffstat (limited to 'print/resources')
| -rw-r--r-- | print/resources/inkstitch.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/print/resources/inkstitch.js b/print/resources/inkstitch.js index 25a5354e..498b1211 100644 --- a/print/resources/inkstitch.js +++ b/print/resources/inkstitch.js @@ -213,6 +213,18 @@ $(function() { $.post('/shutdown', {}) .done(function(data) { window.close(); + + /* Chrome and Firefox both have a rule: scripts can only close windows + * that they opened. Chrome seems to have an exception for windows that + * were opened by an outside program, so the above works fine. Firefox + * steadfastly refuses to allow us to close the window, so we'll tell + * the user (in their language) that they can close it. + */ + setTimeout(function() { + document.open(); + document.write("<html><body>" + data + "</body></html>"); + document.close(); + }, 1000); }); }); @@ -240,7 +252,6 @@ $(function() { $('select#printing-size').change(function(){ var size = $(this).find(':selected').val(); $('.page').toggleClass('a4', size == 'a4'); - console.log("" + Date.now() + "paper size changed"); $.postJSON('/settings/paper-size', {value: size}); }); |
