[SalesForce] Download pdf and video file from html page

I am stuck at a point where I have to give a link to the user on the UI which on getting clicked will download a pdf and video files.

I have placed these files as static resources and I am trying to retrieve them using the "anchor" tag of html5.

I have set the href property of the tag as follows:

pdf file – {!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/Admin.pdf')}

video file – {!URLFOR($Resource.ToolName_StaticResource,'TrainingGuide/AdminVideo.wmv')}

But unfortunately, due to some reason this doesn't work.

Is the href value incorrect? Or, is there something else that I am missing?

Any help would be appreciated.


Best Answer

Try this, I tested it on my sandbox and works as expected:

<apex:outputLink value="{!URLFOR($Resource.pdfFileName)}" target="_blank">PDF Name</apex:outputLink>
<apex:outputLink value="{!URLFOR($Resource.videoFileName)}" target="_blank">Video Name</apex:outputLink>
Related Topic