Skip to content

Commit be92255

Browse files
committed
fix: enable JavaScript in iframe
When an iframe contains the `sandbox` attribute, its value must be exactly `allow-scripts` in order to enable JavaScript. However, in many cases the attribute has more than one value. Here is an example:[^1] ``` sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox" ``` We make the condition more flexible by using `contains`. Fixes DocMarty84/miniflutt#30 [^1]: https://github.com/miniflux/v2/blob/3388f8e376632da49be8d8785422962ba83a8518/internal/reader/sanitizer/sanitizer.go#L238
1 parent 79ec194 commit be92255

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/flutter_html_iframe/lib/iframe_mobile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class IframeWidget extends StatelessWidget {
2020

2121
final sandboxMode = extensionContext.attributes["sandbox"];
2222
controller.setJavaScriptMode(
23-
sandboxMode == null || sandboxMode == "allow-scripts"
23+
sandboxMode == null || sandboxMode.contains("allow-scripts")
2424
? JavaScriptMode.unrestricted
2525
: JavaScriptMode.disabled);
2626

0 commit comments

Comments
 (0)