Bourne
Bourne

Reputation: 1927

Intercepting http requests made from an iframe which contains HTML content from seperate domain

I am working on adding a new functionality to our web application. For this I have to load a web page from a seperate domain in an iframe in my web page and intercept all the HTTP calls made by the iframe in the javascript of my web page.

Can you please let me know how I can achieve this? I googled for this but couldn't find much information about this.

Upvotes: 1

Views: 2904

Answers (1)

Quentin
Quentin

Reputation: 943193

You cannot spy on a user's activity on other domains using an iframe. Browsers forbid it.

Imagine if I did that to your bank's website!

  • If you have the cooperation of the other site then you can communicate between domains, through frames, using postMessage.
  • A browser extension can ignore these restrictions (since it has to be installed by the user)

Upvotes: 3

Related Questions