iframe function
Component
iframe(
- List<
Component> children, { - required String src,
- String? allow,
- String? csp,
- MediaLoading? loading,
- String? name,
- String? sandbox,
- ReferrerPolicy? referrerPolicy,
- int? width,
- int? height,
- Key? key,
- String? id,
- String? classes,
- Styles? styles,
- Map<
String, String> ? attributes, - Map<
String, EventCallback> ? events,
The <iframe> HTML element represents a nested browsing context, embedding another HTML page into the current one.
src
: The URL of the page to embed. Use a value of about:blank to embed an empty page that conforms to the same-origin policy. Also note that programmatically removing an <iframe>'s src attribute (e.g. via Element.removeAttribute()) causes about:blank to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS.allow
: Specifies a feature policy for the <iframe>. The policy defines what features are available to the <iframe> based on the origin of the request (e.g. access to the microphone, camera, battery, web-share API, etc.).csp
: A Content Security Policy enforced for the embedded resource.loading
: Indicates how the browser should load the iframe.name
: A targetable name for the embedded browsing context. This can be used in the target attribute of the <a>, <form>, or <base> elements; the formtarget attribute of the <input> or <button> elements; or the windowName parameter in the window.open() method.sandbox
: Applies extra restrictions to the content in the frame. The value of the attribute can either be empty to apply all restrictions, or space-separated tokens to lift particular restrictions.referrerPolicy
: Indicates which referrer to send when fetching the frame's resource.width
: The width of the frame in CSS pixels. Default is 300.height
: The height of the frame in CSS pixels. Default is 150.
Implementation
Component iframe(List<Component> children,
{required String src,
String? allow,
String? csp,
MediaLoading? loading,
String? name,
String? sandbox,
ReferrerPolicy? referrerPolicy,
int? width,
int? height,
Key? key,
String? id,
String? classes,
Styles? styles,
Map<String, String>? attributes,
Map<String, EventCallback>? events}) {
return DomComponent(
tag: 'iframe',
key: key,
id: id,
classes: classes,
styles: styles,
attributes: {
...attributes ?? {},
'src': src,
if (allow != null) 'allow': allow,
if (csp != null) 'csp': csp,
if (loading != null) 'loading': loading.value,
if (name != null) 'name': name,
if (sandbox != null) 'sandbox': sandbox,
if (referrerPolicy != null) 'referrerpolicy': referrerPolicy.value,
if (width != null) 'width': '$width',
if (height != null) 'height': '$height',
},
events: events,
children: children,
);
}