How to Open Redirect in a New Window


Would you like to have your form redirect open in a new window or tab? With WPForms you can have your form redirect to a new page upon successful form submission. With a small JavaScript code snippet, you can set this redirect to open in a new window or tab. This tutorial will show you how to add this small snippet to your site to open that redirect in a new window.


First, you’ll need to set up your form to redirect upon submission. To do this, please review this tutorial.

Open redirect in new window

Remember to make sure that Enable AJAX form submission is disabled if using this snippet.

Next, copy and paste this code to your site. The code snippet shown below will target only the form ID -909.

 * Redirect link in new tab.
 * @link
function wpf_dev_open_redirect_new( ) {
<script type="text/javascript">
        $("form#wpforms-form-530").attr("target", "_blank");
	document.getElementById("wpforms-form-530").onsubmit = function(){
add_action( 'wpforms_wp_footer_end', 'wpf_dev_open_redirect_new', 30 );

You’ll need to make sure you update the code above to add your own form ID.

And that’s it! You’ve successfully set up the redirect on the form to open in a new window/tab. Would you like to change the title that appears inside the tab of the browser window? Take a look at the tutorial on How to Change the Page Title on the Browser Tab.

Action Reference: wpforms_wp_footer_end