Jump to content

Open external links in downloads


Go to solution Solved by Hisashi,

Recommended Posts

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

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Solution

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.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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