The 'window.parent' property | JavaScript DOM Tutorial

preview_player
Показать описание

You will commonly see this property be used with IFrames' as a way for the embedded HTML page (or script) to access methods, properties or data from its parent HTML page. This can be used to make a generic IFrame structure that is able to load different data dynamically depending on the content provided by its parent. This is quite useful for web applications.

In this video I go over a simple example of how this works with an IFrame and how we are able to embed some text from a parent HTML page into a paragraph tag of the child, embedded IFrame HTML page.

For more info, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Your explanations are so clear! Great teacher. Too bad got Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.

gestata
Автор

appreciate your method of teaching.. precise and informative

zubaircheema
Автор

I really like the click of your keyboard. Sounds like you use some kind of mechanical switches with lube.

WangTmg
Автор

am actually looking for the iframe sending to the parent

immanuelmukondeleli
Автор

iframe does not work. It showes refused to connect. pls solve.

tazulislam
Автор

Also this only works if you are on the same domain. In your example you were on the same domain but people trying to connect different domains this will not work. Atleast I havent found a soluion yet! Lemme know reader if you find one.

sofaking
Автор

Thanks, Can I do the opposite, from parent to a newly Loaded iframe page .
One that is just loaded off the internet ? Thanks

vmars
welcome to shbcf.ru