i have created a from on contact form 7 and on submit have to download pdf.
They script works for me though. But however it oes not open in new tab. How to open new tab in window.location or if window.open how could i parse the value in urs.
function add_this_script_footer() { ?>
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '170' == event.detail.contactFormId ) {
var inputs = event.detail.inputs;
var urs = inputs[6].value;
window.location.href=urs;
setTimeout(function(){ loation.reload(); }, 3000);
}
}, false );
</script>
<?php
}
add_action('wp_footer', 'add_this_script_footer'); ?>
You can try window.open
with target _blank
like below.
window.open(
urs,
'_blank'
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.