Skip to content

Commit 0f1b7c1

Browse files
committed
Instructions on window.close() for different browsers
1 parent b629034 commit 0f1b7c1

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,22 @@ socket.on('connect', function () {
1717
window.open('', '_self', '');
1818
window.close();
1919

20-
let firefoxWarning =
21-
"<h1>Oops!</h1>" +
22-
"<h3>Firefox doesn't allow windows to self-close.</h3>" +
23-
"<h3>If you want the preview window to close automatically like in other browsers, go to about:config and set dom.allow_scripts_to_close_windows to true.</h3>"
20+
let firefoxWarning =`
21+
<h1>Oops!</h1>
22+
<h3>Your browser doesn't allow windows to self-close. </h3>
23+
<h3>If you want the preview window to close automatically </h3>
24+
<ul>
25+
<li>in Firefox, go to about:config and set
26+
dom.allow_scripts_to_close_windows to true.</li>
27+
<li>in Qutebrowser (with old QtWebKit backend), go to :config-edit and
28+
set
29+
<a href='https://qutebrowser.org/doc/help/settings.html#content.javascript.can_close_tabs'>content.javascript.can_close_tabs</a>
30+
to true</li>
31+
<li>in Chromium derivatives it is not possible</li>
32+
</ul>
33+
<b>If it OK to close the browser manually, then do so. Allowing scripts
34+
to close windows not opened by the script is considered a security
35+
risk.</b> `
2436
document.body.innerHTML = firefoxWarning;
2537
});
2638
});

0 commit comments

Comments
 (0)