user2100825
user2100825

Reputation: 11

Possible to alter content of a remote page within an iframe?

Can you manipulate content of a page from different website within an iframe on you own website page?

So, for example, I want to omit the navigation links and comments of a blog but keep the actual content, footer and banner of the original webpage owner.

Upvotes: 1

Views: 90

Answers (1)

Quentin
Quentin

Reputation: 943615

In supporting browsers, this is possible via postMessage (covered by the Web Messaging Specification) but requires the co-operation of the site being framed.

You cannot freely access the DOM of third party websites as this would be a serious security risk (for example: Alice visits Mallory's site. Mallory puts Bob's site in an iframe. Alice's browser auto-fills the username and password fields. Mallory reads them with JavaScript and sends them to her own server.)

Upvotes: 1

Related Questions