Attributo HTML <iframe> srcdoc

❮ Tag HTML <iframe>

Esempio

Un <iframe> con un attributo srcdoc:

<iframe srcdoc="<p>Hello world!</p>" src="demo_iframe_srcdoc.htm"></iframe>

Definizione e utilizzo

L' srcdocattributo specifica il contenuto HTML della pagina da mostrare nel frame inline.

Suggerimento: si prevede che questo attributo venga utilizzato insieme agli attributi sandboxe .seamless

Se un browser supporta l' srcdocattributo, sovrascriverà il contenuto specificato srcnell'attributo (se presente).

Se un browser NON supporta l' srcdocattributo, mostrerà invece il file specificato srcnell'attributo (se presente).


Supporto browser

I numeri nella tabella specificano la prima versione del browser che supporta completamente l'attributo.

Attribute
srcdoc 20.0 79.0 25.0 6.0 15.0

Sintassi

<iframe srcdoc="HTML_code">

Valori di attributo

Value Description
HTML_code The HTML content to show in the iframe. Must be valid HTML syntax

❮ Tag HTML <iframe>