'React On Click Prevent Download but show excel
I have a link from microsoft one drive which is generated when we upload file pythonically. I have linked this link to a button whichis supposed to show the file but not download however on click it is donloading the file so i neeed help regarding how to prevent download but show the excel file linked. Below is react code I have been using
function Files(props){
let getFileOnClick=(fileAddress)=>{
window.location.href=fileAddress
}
return(
<button style={{float:'right'}} onClick = {()=>getFileOnClick(props.link)} className="btn btn-primary">
Get File
</button>
)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
