0

I am trying to change javascript variable when iframing that page. Not the same, but did some similar on pinterest

if (top != self) {
$('body').html('<h1>Unauthorized</h1>')
}

Above is their code. I used this to cancel it

<iframe src="http://www.pinterest.com/?v=
if(top!%3Dself)%7B%24('body').html('%3Ch1%3EUna uthorized%3C%2Fh1%3E')%7D">

This works on chrome. So my question is, ccan we change javascript variables via iframe ?

1

1 Answer 1

2

You can use window.parent.document but beware of cross-domain operations! Have look at this link for more info: how to access iFrame parent page using jquery?

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks but why beware cross-dmoain ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.