On a submit button click, I want to open a child window and redirect the parent window to another location.
To do that, I have used the code for opening child window:
<button class="btnBg" onclick="window.open('<%= url_for(:action=>"index") %>', '', 'toolbars=0')">
Can you please tell me how to redirect the parent window to a desired location?
The easiest way is to assign something to
window.locationin your JavaScript (but be sure to do that after opening your new window):You don’t need to use a separate function though, I just did that to make it easier to read.