Issue
how can download webapge as .html/.png after i inputed text in text box below is my code
<div class="container">
<form>
<div class="form-group">
<label for="link">Paste Website Link Below</label>
<input type="link" class="form-control" id="download" placeholder="Enter website link" >
<br>
<butt class="btn btn-primary">Download </button>
</form></div>
i know this thing works for downloading webpage or any file but want when we type link their and then download help
Solution
This function will create an <a>
element and assign the download link to it, then click it.
function download() {
var link = document.createElement("a");
link.setAttribute("href", document.getElementById("download").value);
link.setAttribute("download", "");
link.click();
}
Your button should look like...
<button class="btn btn-primary" onclick="download()">Download</button>
Answered By - Daemon Beast Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.