How to Get the Sitemap Link of an HTML Document in JavaScript
Jul 9, 2021
In today’s tutorial, we’re going to do you a favor; instead of spending unnecessary time attempting to locate the sitemap link URL of an HTML document, we are going to demonstrate how you can use an API in JavaScript to automate the link retrieval.
Our first step is to install the jQuery library:
bower install jquery
Now, we can call the function with the following example code:
var settings = {
"url": "https://api.cloudmersive.com/convert/edit/html/head/get/sitemap-url",
"method": "POST",
"timeout": 0,
"headers": {
"inputFileUrl": "<string>",
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"inputFile": "<binary>"
}
};$.ajax(settings).done(function (response) {
console.log(response);
});
And we’re done! Simple.