Include noreferrer on embed links / window.open.

This commit is contained in:
Paul
2021-09-17 09:37:07 +01:00
parent c01038db1d
commit b0775c3c6a
4 changed files with 15 additions and 13 deletions

View File

@@ -1,8 +1,9 @@
import { Text } from "preact-i18n";
import Modal from "../../../components/ui/Modal";
import { dispatch } from "../../../redux";
import Modal from "../../../components/ui/Modal";
interface Props {
onClose: () => void;
link: string;
@@ -17,7 +18,7 @@ export function ExternalLinkModal({ onClose, link }: Props) {
actions={[
{
onClick: () => {
window.open(link, "_blank");
window.open(link, "_blank", "noreferrer");
onClose();
},
confirmation: true,
@@ -36,15 +37,17 @@ export function ExternalLinkModal({ onClose, link }: Props) {
const url = new URL(link);
dispatch({
type: "TRUSTED_LINKS_ADD_DOMAIN",
domain: url.hostname
domain: url.hostname,
});
} catch(e) {}
window.open(link, "_blank");
} catch (e) {}
window.open(link, "_blank", "noreferrer");
onClose();
},
plain: true,
children: <Text id="app.special.modals.external_links.trust_domain" />,
}
children: (
<Text id="app.special.modals.external_links.trust_domain" />
),
},
]}>
<Text id="app.special.modals.external_links.short" /> <br />
<a>{link}</a>