Mercurial > addons > firefox-addons > feed-preview
comparison 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 |
comparison
equal
deleted
inserted
replaced
25:da483ce3832d | 26:f0c4a458869c |
---|---|
85 let stylesheetElement = contentDocument.createElement('link'); | 85 let stylesheetElement = contentDocument.createElement('link'); |
86 stylesheetElement.rel = 'stylesheet'; | 86 stylesheetElement.rel = 'stylesheet'; |
87 stylesheetElement.href = | 87 stylesheetElement.href = |
88 browser.runtime.getURL('web_resources/style/entry-content.css'); | 88 browser.runtime.getURL('web_resources/style/entry-content.css'); |
89 contentDocument.head.appendChild(stylesheetElement); | 89 contentDocument.head.appendChild(stylesheetElement); |
90 // open links in a new tab rather than within the iframe | |
91 for (let linkElement of contentDocument.links) { | |
92 linkElement.target = '_blank'; | |
93 } | |
90 contentElement.srcdoc = new XMLSerializer() | 94 contentElement.srcdoc = new XMLSerializer() |
91 .serializeToString(contentDocument); | 95 .serializeToString(contentDocument); |
92 contentElement.title = entry.title; | 96 contentElement.title = entry.title; |
93 | 97 |
94 if (entry.files.length > 0) { | 98 if (entry.files.length > 0) { |