You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Controls referrer info sent with requests (no-referrer, origin, etc.).
loading
Lazy load behavior (lazy or eager).
allowfullscreen
Enables fullscreen capability.
allowpaymentrequest
Enables Payment Request API in iframe.
credentialless
Creates an iframe without credentials (experimental).
csp
Inline Content-Security-Policy specific to the iframe.
title
Accessible title for screen readers.
frameborder, scrolling
Deprecated legacy attributes.
🧩 Inline Event Handlers and Input Forms
You can attach event handlers directly in the HTML tag, similar to other elements. These can trigger scripts when certain events (like load, error, etc.) fire.
You can add event handlers like onload, onerror, or even custom inline logic that interacts with the iframe's content via contentWindow, depending on origin and sandbox rules.
Reference to the iframe element that contains the document.
Example
if(window.top!==window.self){console.log('Running inside an iframe');console.log('My frame element:',window.frameElement);}
🧭 Experimental / Less Common APIs
API
Description
iframe.loading = 'lazy'
Defers loading until near viewport.
iframe.csp
Inline CSP policy specific to iframe.
iframe.credentialless
Iframe runs without cookies or credentials.
window.crossOriginIsolated
True if context is isolated for SharedArrayBuffer.
✅ Summary
Use contentWindow for interaction (same-origin only).
Use postMessage for secure cross-origin communication.
Always configure sandbox and allow attributes for security.
Use lazy loading and referrer policies for performance and privacy.
Inline attributes like src, srcdoc, and event handlers (onload, onerror) can embed or interact with content safely when used correctly.
Frame Busting
check whether the current window and top window references are the same
window.top==window.self
Evasion mechanims for frame busting
using iframe sandbox like allow-forms only. if the frame busting is added as client side javascript check, this allow-forms will disable tbe javascript execution all together