How to Screenshot a URL with JavaScript

Cloudmersive
1 min readJun 2, 2022

--

Grabbing a screenshot of a web page is useful for a number of reasons; for example, it’s an especially big help for website support teams looking to resolve an issue. Using our Screenshot URL API, you can automatically get a full-page image from a web page just by inputting the website URL as a parameter . To take advantage of this API, follow instructions below to structure your API call with JavaScript. and register a free account on our website to get the necessary API key.

Let’s start off by installing the jQuery library. Run the following command:

bower install jquery

After that, let’s call the API:

var settings = {
"url": "https://api.cloudmersive.com/convert/web/url/to/screenshot",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"Url": "<string>",
"ExtraLoadingWait": "<integer>",
"ScreenshotWidth": "<integer>",
"ScreenshotHeight": "<integer>"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});

Just like that, you’re all done — no further code snippets required.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet