function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sumant Kuchipu 1Sumant Kuchipu 1 

How to view file instead of downloading from Apex/VF?

Hi,
When a user clicks on a link, I called VisualForce and then call Apex that calls REST api to "box" and gets download link. I was able to download file from that link provided by BOX using REST api. (see download link below, I made it short since the download link is too big) .
and the file is directly downloading in the next page but I need to open the file instead of downloading

This is download Link returned from Box api:
https://dl.boxcloud.com/d/1/4cp_Tu5yjx8avwjkdIwL1Z4Du4iV8FkvvpQsFPco4fbvdvOvusVR7N89Tca-QOGarhUBNEBV5gKgCh6mj4z1n7URaroUCkRvnD5bTei5U1AuQ33BA../download
VisualForce:
<apex:page controller="BoxController" action="{!fileOpen}">

</apex:page>
Apex Code:
 
public PageReference fileOpen(){
        PageReference page;
        try{
            String bFileId=String.valueof(ApexPages.CurrentPage().getparameters().get('bFileID'));
            String fileDownloadURL= fileFromBoxDownload(bFileId);// This api calls to Box api and get download URL, which is avove link
            page = new PageReference(fileDownloadURL);
            page.setRedirect(true);
            
        } catch (Exception e){
            System.debug(' **** File fileOpen Exceptions '+e);
        }
        return page;
    }

Is there any possiblities to convert that Download to open on new window or same window? 
That would be great if anyone could give the clue, I apreciate your help. 

Thanks,
Sumant