2

I have an iframe that uploads a file to rails

I want to respond back with javascript. The format that comes in is html

I tried

<script>
   // JS code
</script>

But it loaded a new page and then executed the JS

Key is to upload a file asynchronously and then do more things on the page

Gem remotipart seems nice but i want to keep dependencies low

Ruslan
  • 1,919
  • 21
  • 42

1 Answers1

0

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.

Community
  • 1
  • 1