rameezisrar's avatar

Hide an element of an iframe from a different origin

How can we hide an element of an iframe and that iframe source is from another origin

I have tried that

$("#myiframe").contents().find("#myContent").hide();

but that works only when the iframe source is of the same origin.

Any help would be much appreciated.

0 likes
4 replies
Sinnbeck's avatar

BTW. It makes sense that it's not possible. Image if I added YouTube to my website and the via Javascript logged you out, and asked you to login again. I could then change the login url to my own endpoint, meaning you would send your credentials to me :)

1 like
rameezisrar's avatar

thanks, @sinnbeck @tray2

For the cross-origin iframe src, getting the file contents and then rendering it to iframe works for me

Please or to participate in this conversation.