简体   繁体   English

在联系表7上下载pdf在新标签页中提交

[英]Download pdf on contact form 7 submit in new tab

i have created a from on contact form 7 and on submit have to download pdf. 我从联系表格7中创建了一个,并在提交时必须下载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. 如何在window.location中打开新标签页,或者如果window.open如何在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. 您可以使用目标_blank尝试使用window.open ,如下所示。

 window.open(
      urs,
      '_blank' 
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM