How to screenshot a website/URL in Javascript

Here is a super quick tutorial on how to use one of our APIs to screenshot a URL.

Add this script tag to your HTML file to import the API client that we will be using today.

<script src=""></script>

Now call our URL screenshot function as shown here:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveConvertApiClient.ConvertWebApi();var input = new CloudmersiveConvertApiClient.ScreenshotRequest(); // ScreenshotRequest | Screenshot request parametersvar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.convertWebUrlToScreenshot(input, callback);

That’s it! Seriously, how easy was that? If you want more useful functions like this that are just as easy to implement, we’ve got you covered. We have hundreds of other APIs that run the gamut from converting image formats to running optical character recognition on photos.

Image for post

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store