diff js/feed-preview.js @ 26:f0c4a458869c

Open links within feed content in a new tab Open links within feed content in a new non-sandboxed tab rather than in the sandboxed iframe itself.
author Guido Berhoerster <guido+feed-preview@berhoerster.name>
date Wed, 02 Jan 2019 21:53:37 +0100
parents ff5e5e3eba32
children 688d75e554e0
line wrap: on
line diff
--- a/js/feed-preview.js	Fri Dec 28 12:27:16 2018 +0100
+++ b/js/feed-preview.js	Wed Jan 02 21:53:37 2019 +0100
@@ -87,6 +87,10 @@
         stylesheetElement.href =
                 browser.runtime.getURL('web_resources/style/entry-content.css');
         contentDocument.head.appendChild(stylesheetElement);
+        // open links in a new tab rather than within the iframe
+        for (let linkElement of contentDocument.links) {
+            linkElement.target = '_blank';
+        }
         contentElement.srcdoc = new XMLSerializer()
                 .serializeToString(contentDocument);
         contentElement.title = entry.title;