Proprietà IFrame src
Esempio
Modifica l'URL del documento da incorporare nell'iframe:
document.getElementById("myFrame").src = "https://wwf.org";
Definizione e utilizzo
La proprietà src imposta o restituisce il valore dell'attributo src in un elemento iframe.
L'attributo src specifica l'URL del documento da mostrare in un iframe.
Supporto del browser
Property | |||||
---|---|---|---|---|---|
src | Yes | Yes | Yes | Yes | Yes |
Sintassi
Restituisce la proprietà src:
iframeObject.src
Imposta la proprietà src:
iframeObject.src = URL
Valori di proprietà
Value | Description |
---|---|
URL |
Specifies the URL of the document to embed in the iframe. Possible values:
|
Dettagli tecnici
Valore di ritorno: | Una stringa, che rappresenta l'URL del documento incorporato nell'iframe. Restituisce l'intero URL, incluso il protocollo (come http://) |
---|
Altri esempi
Esempio
Ottieni l'URL del documento mostrato in un iframe:
var x = document.getElementById("myFrame").src;
Pagine correlate
Riferimento HTML: attributo HTML <iframe> src
❮ Oggetto IFrame