Reputation: 13
I have an external site in an iframe with a save button. When the user clicks the save button a json file is downloaded, I would like to be able to capture the contents of this file in my own code. Is there any way to do this?
I read that you cannot specify a download location outside of the browser defined location, and could only find questions related to initiating a download with an iframe rather than capturing one.
Upvotes: 1
Views: 1091
Reputation: 1864
You cannot do it unless you can setup the Access-Control-Allow-Origin
(in HttpHeader) of your external site. (check out Access-Control-Allow-Origin
on google)
There is a security reason to prevent user read data from other site without permission, for example, the user may logged in the bank site while browsing another site abc.com (in other tab), the bank will not allow abc.com download the users information from them by JavaScript.
Upvotes: 1