]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid having eww unexpectedly open external browsers
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Jan 2017 22:39:05 +0000 (23:39 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 24 Jan 2017 22:39:05 +0000 (23:39 +0100)
* lisp/net/eww.el (eww-render): Instead of opening unsupported
content types like audio/mpeg directly in an external browser
(which can be very confusing especially when something
redirects to a file like that), just display a simple
interstitial that people can choose to click on or not
(bug#22671).

lisp/net/eww.el

index 3e5d4467eac6243ad20341511b7e63bf0ab0d4fd..172044a12ec5e8973e5e5961ca66445b426bc24c 100644 (file)
@@ -364,7 +364,14 @@ Currently this means either text/html or application/xhtml+xml."
            ((and eww-use-external-browser-for-content-type
                  (string-match-p eww-use-external-browser-for-content-type
                                  (car content-type)))
-            (eww-browse-with-external-browser url))
+            (erase-buffer)
+            (insert "<title>Unsupported content type</title>")
+            (insert (format "<h1>Content-type %s is unsupported</h1>"
+                            (car content-type)))
+            (insert (format "<a href=%S>Direct link to the document</a>"
+                            url))
+            (goto-char (point-min))
+           (eww-display-html charset url nil point buffer encode))
           ((eww-html-p (car content-type))
            (eww-display-html charset url nil point buffer encode))
           ((equal (car content-type) "application/pdf")