Window.frameElement
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Window.frameElement
속성은 이나
처럼 현재 창을 포함한 요소를 반환합니다. 창이 다른 문서에 포함된 것이 아니거나, 문서의 출처가 다른 경우, 즉 창과 해당 문서의 도메인이 서로 다른 경우
null
을 반환합니다.
예제
js
var frameEl = window.frameElement;
// If we're embedded, change the containing element's URL to 'http://mozilla.org/'
if (frameEl) {
frameEl.src = "http://mozilla.org/";
}
명세
Specification |
---|
HTML # dom-frameelement-dev |
브라우저 호환성
같이 보기
window.frames
는 현재 창의 모든 자식 프레임을 배열형 객체로 나열합니다.window.parent
는 부모 창, 즉frameElement
를 담고 있는 창을 반환합니다.