Tuesday, May 5, 2015

How to redirect the whole page when you submit a form in an iframe

Thanks to this post on StackOverflow, I found to redirect the whole page when you submit the form with an iframe inside.


Problem: You have an iframe which got a form, when you use the iframe to submit the form, the page will not redirect normally and this might cause some behavior which you don't like.

Solution: Add target='_parent' to the form.

Example:  <form action="/signup" method="post" enctype="multipart/form-data" target='_parent'>

You don't have to add anything to the iframe. This should work.
Share:

0 comments:

Post a Comment