I have the following code which create hyperlinks:
<div class="col-md-12">
{% set href = 'customers/outputfile/' ~ doc.ICDU_GUID %}
<a href="{{ href | _base_url }}" target="_blank">{{ docName }}</a>
</div>
An example of a generated URL is localhost:8080/customers/outputfile/b41b055e-91ad-4dc8-8184-9cb910cb3e02
In the controller, I fetch the location of the document and then return the response:
public function outputFile($id) {
$dbCustomersModel = new DB_CustomersModel();
$filePath = $dbCustomersModel->getFilepathFromId($id);
return $this->response->download($filePath->ICDU_DocLocation, null);
}
When I click on the hyperlink, a new tab is opened but closed immediately and the file download popup appears.
What I want is for the file to open in a new tab rather than being asked to download it. The files can be images, pdf, etc...