We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

window.frameElement Redirect 1


Returns the element (such as <iframe> or <object>) in which the window is embedded, or null if the window is top-level.


frameEl = window.frameElement;
  • frameEl is the element which the window is embedded into, or null if the window is top-level.


var frameEl = window.frameElement;
// If we are inside a frame, then change its URL to 'http://mozilla.org/'
if (frameEl) {
  frameEl.src = 'http://mozilla.org/';


Note that despite its name, the property also works for documents inside <object> and other embedding points.



Browser compatibility

Help improve compatibility tables by filling out this 11 question survey.
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 18 1.0 (1.7 or earlier) 5.5? ? ?
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? 1.0 (1.7 or earlier) ? ? ?

See also

  • window.frames returns an array-like object, listing the direct sub-frames of the current window.
  • window.parent returns the parent window, which is the window containing the frameElement of the child window.

Document Tags and Contributors

Last updated by: Sheppy,