0

I am looking for the way to call the javascript method inside with a different domain iframe.

For example, app.facebook.com contains iframe yyy.com inside.

I would like to call the yyyMethod() inside iframe yyy.com.

app.facebook.com |__iframe src="yyy.com" name="yyy" |__yyyMethod();

  • I tried window.frames["yyy"].contentWindow.yyyMethod(), but it return exception saying that we could not call method across domain.

Restrictions are

1) Adding/Modifying content in both app.facebook.com and yyy.com are prohibited, since I am not the site owner.

2) Execute from browser javascript console is one way to do, but I want to write plug the yyyMethod() caller with some javascipt code. Therefore, execute from browser javascript console may not be a good idea.

Any idea how to do this ? Not sure whether we can call from the chrome extension, bookmarklet, or something else ??

Roemer
  • 3,566
  • 1
  • 16
  • 32
dsin
  • 71
  • 2
  • 5
  • Possible duplicate of [Invoking JavaScript code in an iframe from the parent page](http://stackoverflow.com/questions/251420/invoking-javascript-code-in-an-iframe-from-the-parent-page) – Roemer Dec 14 '15 at 11:49
  • @Roemer — No. That question is about *same* origin communication, not cross origin communication. – Quentin Dec 14 '15 at 11:52
  • A browser extension might make this achievable (I don't know enough about them to say) but nothing else will. – Quentin Dec 14 '15 at 11:53
  • Thanks @Quentin. Now I come up with the browser extension, and it works ! – dsin Feb 23 '16 at 15:13

0 Answers0