You need to sign in to do that
Don't have an account?
Praveen Kumar 9
Download and stay on the same page
I have a requirement like when the user clicks on a link it returns a download link and user should be able to download that file and stay on the same page.
The problem is when the DL link is posted or redirected using page reference the page refreshes and gives a blank page.
any suggestion on how this could be done
The problem is when the DL link is posted or redirected using page reference the page refreshes and gives a blank page.
any suggestion on how this could be done
Can you please show the code.
You can use return type of the method as pageReference.
and return null at the end of the method, so then it will be on the same page
Regards,
AbhI Tripathi
SFDC Certified Developer
This is the code we are trying - This get executed ocne the user clicks a file name
String FileValue = filesToIdMap.get(fileName);
string endPointValue = 'https://api.box.com/2.0/files/'+FileValue+'/content';
req.setEndpoint(endPointValue);
req.setHeader('Authorization:', 'Bearer ' + getAccessToken());
req.setMethod('GET');
HttpResponse res = h.send(req);
system.debug('$$$$$$$$ res --> ' +res);
system.debug('$$$$$$$$ res Header Location --> ' +res.getheader('Location'));
The returned value 'Location' is the temporary DL link given by BOX ( another cloud storage and we are doing SF to Box integration ) .
So now once the Location is returned we have to make sure the user get the DL file , as well as staying in the same page.
If i do pagereferance to the 'Location' what happens is the file gets downloaded and blank page is displayed. I want to return back to the old page.