How to redirect a Link to a new tab in contact form 7?

Question

I was trying to redirect my contact form 7 to specific pdf link. But I m not sure how to open it in new tab can someone help me up with the same ?

Below is my code…

add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
?>
<script type="text/javascript">
document.addEventListener( 'wpcf7submit', function( event ) {
if ( '876' == event.detail.contactFormId ) {
    location = 'https://spilledsunshine.com/wp-content/uploads/2020/10/10-Reminders-To-Myself-By-Ishita-Mehta.pdf';
    target = '_blank';
}
}, false );
</script>
<?php
}

target = ‘_blank’; is not working is there any other option to open in new tab ?

0
Mohammed Hussain Merchant 1 month 0 Answers 9 views 0

Leave an answer