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 ?

user198989
  • 4,574
  • 19
  • 66
  • 95
  • same origin policy is something you should be aware: http://en.wikipedia.org/wiki/Same_origin_policy So, to answer your question, you cannot – A. Wolff May 26 '13 at 14:13

1 Answers1

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?

Community
  • 1
  • 1
Ted
  • 3,985
  • 1
  • 20
  • 33