Disable opening of popup when downloading a file

admin

Administrator
Staff member
I am creating a wordpress page that allows users to downloads a zip file after 5 secs. In it, I am calling a second page and pass POST parameters ( zip id :: to fetch zip path). The page is called but always as a pop up. I am looking for a <strong>clean download options, where without opening tabs or new window, download begins</strong>. Bypasses popup - blockers also.

I have tried two methods

A) Method 1 ( Jquery Post)

Code:
$.post(
        "&lt;?php echo get_permalink(get_page_by_title('Download Page')); ?&gt;",
        {attachment_path: "&lt;?php echo $attachment[0]-&gt;ID ; ?&gt;"
    }

B) Method 2 (Submitting a form)

Code:
$( '&lt;form action="" method="post" target="_parent" class="hide"&gt;
       &lt;input type="hidden" name="attachment_path" value="&lt;?php echo $attachment[0]-&gt;ID ; ?&gt;" /&gt;
       &lt;input type="submit" name="submit" value="submit" id="target-counter-button"/&gt;
    &lt;/form&gt;'
   ).submit();

<strong>Edit</strong>

1) Looking for a POST method to implement the logic

2) Due to server restrictions, direct access to *.php files and *.zip files have been blocked

3) Parent Download Page should remain open in the process

Looking for a expert advice on this issue.

Thanks