Jump to content

Open external links in downloads


Go to solution Solved by Hisashi,

Recommended Posts

Posted

I store my files with an external file host. And when i "Add files by URL" the page opens i the same window. I want it to open in a new window. I've gone through everything in the control panel but can't find anything that can do this. Anybody who can help me with this ????

Eivind

Posted

Are you just pointing to files on that external host or is it like a download page that comes up?

Normally, there should be no need to worry about the windows with direct file links. If everything is set up properly, the external file would just be downloaded and the user would stay on your website. 

Posted

I think he's talking about submit files from URLs, like:

2P7SPOg.png

In that case, when you click to download, you're redirected to that site.

			/* Download */
			if ( $data['record_type'] === 'link' )
			{
				\IPS\Output::i()->redirect( $data['record_location'] );
			}
			else
			{
				$file = \IPS\File::get( 'downloads_Files', $data['record_location'], $data['record_size'] );
				$file->originalFilename = $data['record_realname'] ?: $file->originalFilename;
				$this->_download( $file );
			}

Location:

sVpOpyy.png

This can be done via plugin.

Posted
2 minutes ago, Adriano Faria said:

think he's talking about submit files from URLs,

Yes, that’s what I mean as well. If you add a file URL (not a page), it should directly download that file. That’s why I am asking what type of URL we are talking about. 

  • Solution
Posted

Themes > Edit HTML/CSS (Enter advanced mode if you are on simple) > Templates > downloads > view > downloadButton
 

Add a "target="_blank"" on line 11, the code will look like this:

	{{else}}
		<a target="_blank" href='{{if settings.idm_antileech AND !$file->requiresDownloadConfirmation()}}{$file->url('download')->csrf()}{{else}}{$file->url('download')}{{endif}}' class='ipsButton ipsButton_fullWidth ipsButton_large ipsButton_important' {{if $file->requiresDownloadConfirmation()}}data-ipsDialog{{endif}} data-datalayer-postfetch >{lang="download_now"}</a>
	{{endif}}
</li>


Some observations...

  • You will no longer receive auto-update in this edited template.
  • I only recommend it if your downloads are based on external links, I don't know how that might behave for uploaded files.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...