fetch html from url
fetch('/about').then(function (response) {
// The API call was successful!
return response.text();
}).then(function (html) {
// Convert the HTML string into a document object
var parser = new DOMParser();
var doc = parser.parseFromString(html, 'text/html');
// Get the image file
var img = doc.querySelector('img');
console.log(img);
}).catch(function (err) {
// There was an error
console.warn('Something went wrong.', err);
});
Also in HTML:
- Sending HTML Code Through JSON
- bootstrap checkbox inline
- string to html javascript react
- Finding HTML Elements
- add a caption of picture html
- html script mime type
- html basics
- underline text in html
- start html
- set default value of a multiselect in html
- vertical bar in html
- html how to embed a website
- how to add a paragraph in html
- how to make a textbox in html
- Uncaught TypeError: Failed to execute 'insertAdjacentElement' on 'Element': parameter 2 is not of type 'Element'
- play audio html
- html how to type a long string in many lines
- html ul types
- psd to html
- How to install CentOS 7 Linux in VMware Workstation
- theme colur in html
- how to put one div over another
- meta name viewport
- html space tag