I have an iframe that uploads a file to rails
// JS code
Look into Window.postMessage() for cross-origin communication. Refer to this post Html5 - Cross Browser Iframe postmessage - child to parent? to learn how to send child-to-parent page messages.