<html lang="pt-br" dir="ltr"><head></head><body>### [How to Open Redirect in a New Window](https://wpforms.com/developers/how-to-open-redirect-in-a-new-window/)

**Published:** April 29, 2020
**Author:** Umair Majeed

**Excerpt:** This tutorial will show you how to set up the redirect on form submission into a new window or tab. 

**Content:**

Would you like to have your form’s redirect open in a new window or tab? With WPForms you can have your form redirected 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.

## Opening the redirect in a new window

Before we create the form, we’re going to begin by adding this snippet to our site.

If you’re not sure where or how to add snippets to your site, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Open. redirect in a new window
 *
 * @link https://wpforms.com/developers/how-to-open-redirect-in-a-new-window/
 */
 
function wpf_dev_open_redirect_new( ) {
?&gt;

<script type="text/javascript">
    jQuery(function($) {
        // Open form submission in a new window
        $( "form#wpforms-form-909" ).attr( "target", "_blank" );

        // Listen to the WPForms custom event for successful submission
        $(document).on('wpformsAjaxSubmitSuccess', function(e, data) {
            if (data.data.form_id == 909) {
                location.reload(true);
            }
        });
    }); 
</script>
<!--?php
}

add_action('wpforms_wp_footer_end', 'wpf_dev_open_redirect_new', 30);
```

Remember to replace **909** with your actual form ID.

**Categories:** Extending

**Tags:** JS, PHP

---

--></body></html>