Ben McCurdy
Ben McCurdy

Reputation: 41

Block Same Domain Iframe Access To Parent

I have a website xyz.com with an iframe that loads xyz.com/usersubmittedpage.html inside the iframe.

How can i block the inner page from accessing the parent page. Same Origin Policy allows it to access everything in the parent. Is there another approach I could use to load this page without giving it access to the parent content while keeping it in the same domain.

Upvotes: 4

Views: 2915

Answers (1)

JayC
JayC

Reputation: 7141

Well...

There is the sandbox attribute to iframes: https://developer.mozilla.org/en-US/docs/HTML/Element/iframe#attr-sandbox

But it's only supported (reliably) in Chrome (as of this writing, 9/11/2012). (It will be supported/is supported elsewhere, but barely.)

Upvotes: 3

Related Questions