I integrate a third-party photo upload service with my application. So I upload it to my page through an iframe.
When the download service is loading my photo, it can trigger a specific event on my parent ie page:
parent.$('body').trigger('photoUpload.complete');
or runs a function on the parent page ie:
window.parent.reloadParentPage();
Anyway, I get this warning on my Chrome console:
Uncaught SecurityError: Blocked a frame with origin "https://photoupload.com" from accessing a frame with origin "https://website.com".
I understand that this is the security issue described here:
http://www.w3.org/TR/2008/WD-access-control-20080912/
So, I wanted the source to https://photoupload.comhave access to my site. I did this in my controller:
after_filter :set_access_control_headers
Then the method:
def set_access_control_headers
headers['Access-Control-Allow-Origin'] = "https://photoupload.com"
headers['Access-Control-Request-Method'] = '*'
end
, , https://photoupload.com - , https://website.com - . ( , , ), .
?
, :
jQuery iframe
, : ? ?
II
? //- iframe , -