There's HTML code written for the download button. The complete SharePoint 2013 hosted software functionality has js code. There's a WCF solution the use of c# to get information from sap gadget. There may be one page in the application which has a download button. As soon as clicked using the user, the file must get downloaded from azure blob garage. Kindly assist with how we can obtain this.
1 Replies
<!DOCTYPE html>
<html>
<body>
<style>
p {
color: green;
}
</style>
<p>
How to trigger a file download when
clicking an HTML button or JavaScript?
<p>
<textarea
id="text">
Welcome to GeeksforGeeks
</textarea>
<br/>
<input
type="button"
id="btn"
value="Download"
/>
<script>
function download(file, text) {
//creating an invisible element
var element = document.createElement('a');
element.setAttribute('href',
'data:text/plain;charset=utf-8, '
+ encodeURIComponent(text));
element.setAttribute('download', file);
// Above code is equivalent to
// <a
href="path of file"
download="file name">
document.body.appendChild(element);
//onClick property
element.click();
document.body.removeChild(element);
}
// Start file download.
document.getElementById("btn")
.addEventListener("click", function() {
// Generate download of hello.txt
// file with some content
var text = document.getElementById("text").value;
var filename = "GFG.txt";
download(filename, text);
}, false);
</script>
</body>
</html>