Which is the best way to download a ContentDocument by the button's onclick event? (Available also in community)
1 Answer
You can do the trick using navigation:
In HTML
<lightning-button label="Click me" onclick={download}></lightning-button>
In Javascript
download() {
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: '/sfc/servlet.shepherd/document/download/0692w000000MmSyAAK?operationContext=S1'
}
})
}