HTMLIFrameElement: src property

The HTMLIFrameElement.src property reflects the HTML referrerpolicy attribute of the <iframe> element defining which referrer is sent when fetching the resource.

Syntax

js

refStr = iframeElt.src
iframeElt.src= refStr

Example

js

const iframe = document.createElement("iframe");
iframe.src = "/";
const body = document.querySelector("body");
body.appendChild(iframe); // Fetch the image using the complete URL as the referrer

Specifications

Specification
HTML Standard
# dom-iframe-src

Browser compatibility

BCD tables only load in the browser

See also