diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 803418403..cd5294010 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -128,6 +128,8 @@ |<>|Whether JavaScript programs can open new windows. |<>|Whether JavaScript programs can close windows. |<>|Whether JavaScript programs can read or write to the clipboard. +|<>|Whether all javascript prompts should be ignored. +|<>|Whether all javascript alerts should be ignored. |<>|Whether locally loaded documents are allowed to access remote urls. |<>|Whether locally loaded documents are allowed to access other local urls. |<>|Whether to accept cookies. @@ -1079,6 +1081,28 @@ Valid values: Default: +pass:[false]+ +[[content-ignore-javascript-prompt]] +=== ignore-javascript-prompt +Whether all javascript prompts should be ignored. + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[false]+ + +[[content-ignore-javascript-alert]] +=== ignore-javascript-alert +Whether all javascript alerts should be ignored. + +Valid values: + + * +true+ + * +false+ + +Default: +pass:[false]+ + [[content-local-content-can-access-remote-urls]] === local-content-can-access-remote-urls Whether locally loaded documents are allowed to access remote urls. diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index d6ec5bfc9..f9e66454a 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -87,7 +87,8 @@ class BrowserPage(QWebPage): def javaScriptPrompt(self, _frame, msg, default): """Override javaScriptPrompt to use the statusbar.""" - if self._is_shutting_down: + if (self._is_shutting_down or + config.get('content', 'ignore-javascript-prompt')): return (False, "") answer = self._ask("js: {}".format(msg), usertypes.PromptMode.text, default) @@ -433,7 +434,8 @@ class BrowserPage(QWebPage): def javaScriptAlert(self, _frame, msg): """Override javaScriptAlert to use the statusbar.""" - if self._is_shutting_down: + if (self._is_shutting_down or + config.get('content', 'ignore-javascript-alert')): return self._ask("[js alert] {}".format(msg), usertypes.PromptMode.alert) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 546cb0db9..a54937309 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -542,6 +542,14 @@ DATA = collections.OrderedDict([ SettingValue(typ.Bool(), 'false'), "Whether JavaScript programs can read or write to the clipboard."), + ('ignore-javascript-prompt', + SettingValue(typ.Bool(), 'false'), + "Whether all javascript prompts should be ignored."), + + ('ignore-javascript-alert', + SettingValue(typ.Bool(), 'false'), + "Whether all javascript alerts should be ignored."), + ('local-content-can-access-remote-urls', SettingValue(typ.Bool(), 'false'), "Whether locally loaded documents are allowed to access remote "