Below is the code I using for iframe
final widget = LayoutBuilder(
builder: (context, constraints) {
final iframe = IFrameElement()
..width = constraints.maxWidth.toString()
..height = constraints.maxHeight.toString()
..src = 'https://thirdpartyweb.com'
..style.border = 'none';
// ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(
'iframe',
(int viewId) => iframe,
);
final iframeWidget = HtmlElementView(
key: UniqueKey(),
viewType: 'iframe',
);
return iframeWidget;
},
);
I am able to display my own appbar, iframe and bottom navigation bar, but when i try to navigate inside the iframe, it redirect the browser url. Is there anyway to apply
<iframe src="url" sandbox="allow-same-origin"></iframe>
so that it won't redirect the parent window? Or is there any other way to do this?