changeset 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 da483ce3832d
children 15b828787c8b
files js/feed-preview.js web_resources/feed-preview.xhtml
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
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;
--- a/web_resources/feed-preview.xhtml	Fri Dec 28 12:27:16 2018 +0100
+++ b/web_resources/feed-preview.xhtml	Wed Jan 02 21:53:37 2019 +0100
@@ -26,7 +26,8 @@
               <p class="entry-date"><time></time></p>
             </header>
           </summary>
-          <iframe class="entry-content" srcdoc="" title="" sandbox=""
+          <iframe class="entry-content" srcdoc="" title=""
+          sandbox="allow-popups allow-popups-to-escape-sandbox"
           width="800" height="360"></iframe>
         </details>
       </article>