Gravity page redirect in new tab

Is there any way to open page redirect in new tab. I had already used the given hook by gravity form which is following. But my page dont have wp_head and wp_footer included. I think that’s why that hook is not working. Is there any other way to do this with JS script??

add_filter( 'gform_confirmation', function ( $confirmation, $form, $entry, $ajax ) {
    GFCommon::log_debug( _METHOD_ . '(): running.' );
    if ( isset( $confirmation['redirect'] ) ) {
        $url = esc_url_raw( $confirmation['redirect'] );
        GFCommon::log_debug( _METHOD_ . '(): Redirect to URL: ' . $url );
        $confirmation = 'Thanks for contacting us! We will get in touch with you shortly.';
        $confirmation .= "<script type=\"text/javascript\">'$url', '_blank');</script>";
    return $confirmation;
}, 10, 4 );

Hi Jesse. This code is pretty simple. It just takes the confirmation URL you set in the Confirmation settings, shows a quick message (Thanks for contacting us! We will get in touch with you shortly) and then appends the redirect script. It’s not even jQuery, just JavaScript.

Try using the script in a plain text confirmation by itself, without the gform_confirmation filter to see if that works. You will need to set the $url yourself, because you would not be using the filter.

You could put this by itself in the confirmation text to try it ( I just tried it and it worked ):

<script>'', '_blank');</script>

There are no dependencies on jQuery or anything like that, so it should not matter if there is wp_head or wp_footer.

I tried but I can’t succed to open in a blank page …
And I need to sen datas to the query string
I need this solution for only one of my three forms …
please help me

Hi Julien. I know you have already opened a support ticket and that Karl has replied, so please continue to follow up there. Thank you.

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.