WordPress Download Monitor Plugin › Forums › Download Monitor Plugin Forum › Download target blank not working
Tagged: target
- This topic has 12 replies, 2 voices, and was last updated 6 years, 4 months ago by koenhiemstra.
-
AuthorPosts
-
June 24, 2018 at 9:25 pm #542koenhiemstraParticipant
Hello,
I am using the shortcode to generate the link [sdm_download_link id=””]. I am trying to download the GPX file in a new window (target=”_blank”). This isn’t working and the gpx file is opened in the current tab of the internet browser. See rondjedoen.nl/alle-klassiekers-vanuit-spa/ in the sidebar –> Download Route button. Is there a way to download the file in a new window when using the [sdm_download_link id=””] shortcode?
Thanks!
June 24, 2018 at 9:36 pm #543koenhiemstraParticipantThis is my code:
<a href="[sdm_download_link id="1041"]" title="Download Route" target="_blank" > Download Route </a>
June 24, 2018 at 11:10 pm #551adminKeymasterWordPress doesn’t let you use any shortcode inside the value of the “href” parameter. So what you have there is not going to work.
Since you want to create a link, you could use the option explained in the following documentation. See the “Download URL That Can be Used in an Email or in a Link” section:
June 27, 2018 at 11:50 am #554koenhiemstraParticipantYes, thanks for your response. When I am using this approach, the file still opens in Firefox and IE instead off a popup to download the file. In Google Chrome the target blank is working properly. I also manually created some download files without the Simple Download Monitor plugin shortcode. These are downloading correctly (not in the internet browser for both IE and Firefox). See code below:
<a href="<?php echo '/wp-content/uploads/gpx/' . $gpx_url; ?>" target="_blank" download="" title="Download Route" class="btn btn-primary btn-lg">Download Route</a>
See the difference when clicking on the download route button on the right sidebar:
with download monitor plugin: rondjedoen.nl/rondje-ringvaart/
without download monitor plugin (manually created link): rondjedoen.nl/fietsen-langs-kinderdijk/Could you help me out? Or is this just a restriction of the plugin?
June 27, 2018 at 1:52 pm #558adminKeymasterLooks like it is failing to properly read that file. Are you using PHP dispatch option in that download item’s configuration? If you are how does it behave if you uncheck that option?
June 27, 2018 at 2:11 pm #560koenhiemstraParticipantNo I am not using the PHP dispatch option, PHP dispatched was already unchecked.
June 28, 2018 at 4:20 am #568adminKeymasterWhat happens if you enable the PHP dispatch option? What happens if you put that file inside a folder and make it a .zip file?
This is a little strange so I am trying various things to see if there is a setup that works better on this site.
June 28, 2018 at 12:17 pm #570koenhiemstraParticipantWhen I enable the PHP dispatch option, nothing changes and the file still opens in the web browser. When I put the file in a folder and zip it, the download function works fine and the zip file is downloaded the way I want it. But I would like to offer the file directly to the users instead off in a .zip file. Of course this is a option, but do you think it is also possible with the .gpx file?
I just noticed that it is not possible to upload a gpx file, when I want to upload a file in the download item. A message appears “Sorry, this file type is not permitted for security reasons”. Might it have to do with this? Before I manually placed a link to the gpx file on my server (which I uploaded by the WP GPX Maps).
I really appreciate your help!
June 28, 2018 at 12:51 pm #571adminKeymasterWordPress restricts uploading of some file types. You can use the following addon to remove that restriction:
After that you should be able to upload that file using the media uploader.
June 28, 2018 at 1:43 pm #572koenhiemstraParticipantI downloaded and activated the plugin. But still I am not able to upload the GPX file. Are you sure this plugin is also compatible with the .gpx extension?
Do you think this is also the reason why the file cannot be downloaded outside the internet browser?
June 29, 2018 at 12:29 am #573adminKeymasterI am not sure about the .gpx extension. I never dealt whit that extension before. The browsers are likely getting a little suspicious about it and stopping it. I would say its better for you to go with the zip file approach then you eliminate this issue. Its very common to receive a zip file as a download when you download an item from a website.
June 29, 2018 at 10:16 am #593koenhiemstraParticipantYes, you are right. I will do that. Thanks for your help.
I still have another question. I only want to make the downloadable files available for people that have logged in. When enabled the option “Only Allow Logged-in Users to Download” at the settings page. If I am logged out and I click on the download button, first a the browser has a problem loading and the message ‘File not found’ appears. When I refresh that page, a page appears with the message
You need to be logged in to download this file. Click here to go to login page.
I would like to have this page directly after clicking the download button when you are logged out. Now users first see an page with an error. I want to directly motivate them to loggin. Is that possible?
June 29, 2018 at 3:15 pm #594koenhiemstraParticipantNever mind. I already found a solution. Thanks for all your help.
-
AuthorPosts
- You must be logged in to reply to this topic.