Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/panels/lovelace/cards/hui-iframe-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
`;
}

let sandbox_user_params = "";
if (this._config.allow_open_top_navigation) {
sandbox_user_params += "allow-top-navigation-by-user-activation";
}

return html`
<ha-card .header=${this._config.title}>
<div
Expand All @@ -91,7 +96,7 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
<iframe
title=${ifDefined(this._config.title)}
src=${this._config.url}
sandbox="allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"
sandbox="${sandbox_user_params} allow-forms allow-modals allow-popups allow-pointer-lock allow-same-origin allow-scripts"
allow="fullscreen"
></iframe>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/panels/lovelace/cards/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export interface HumidifierCardConfig extends LovelaceCardConfig {
}

export interface IframeCardConfig extends LovelaceCardConfig {
allow_open_top_navigation?: boolean;
aspect_ratio?: string;
title?: string;
url: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "../../../../components/ha-form/ha-form";
import { html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import { assert, assign, object, optional, string } from "superstruct";
import { assert, assign, boolean, object, optional, string } from "superstruct";
import { fireEvent } from "../../../../common/dom/fire_event";
import type { SchemaUnion } from "../../../../components/ha-form/types";
import type { HomeAssistant } from "../../../../types";
Expand All @@ -15,6 +15,7 @@ const cardConfigStruct = assign(
title: optional(string()),
url: optional(string()),
aspect_ratio: optional(string()),
allow_open_top_navigation: optional(boolean()),
})
);

Expand Down