addons/firefox-addons/feed-preview

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 Jan 02 21:53:37 2019 +0100 (17 months ago)
parents da483ce3832d
children 15b828787c8b
files js/feed-preview.js web_resources/feed-preview.xhtml
line diff
     1.1 --- a/js/feed-preview.js	Fri Dec 28 12:27:16 2018 +0100
     1.2 +++ b/js/feed-preview.js	Wed Jan 02 21:53:37 2019 +0100
     1.3 @@ -87,6 +87,10 @@
     1.4          stylesheetElement.href =
     1.5                  browser.runtime.getURL('web_resources/style/entry-content.css');
     1.6          contentDocument.head.appendChild(stylesheetElement);
     1.7 +        // open links in a new tab rather than within the iframe
     1.8 +        for (let linkElement of contentDocument.links) {
     1.9 +            linkElement.target = '_blank';
    1.10 +        }
    1.11          contentElement.srcdoc = new XMLSerializer()
    1.12                  .serializeToString(contentDocument);
    1.13          contentElement.title = entry.title;
     2.1 --- a/web_resources/feed-preview.xhtml	Fri Dec 28 12:27:16 2018 +0100
     2.2 +++ b/web_resources/feed-preview.xhtml	Wed Jan 02 21:53:37 2019 +0100
     2.3 @@ -26,7 +26,8 @@
     2.4                <p class="entry-date"><time></time></p>
     2.5              </header>
     2.6            </summary>
     2.7 -          <iframe class="entry-content" srcdoc="" title="" sandbox=""
     2.8 +          <iframe class="entry-content" srcdoc="" title=""
     2.9 +          sandbox="allow-popups allow-popups-to-escape-sandbox"
    2.10            width="800" height="360"></iframe>
    2.11          </details>
    2.12        </article>