Tools to Capture and Convert the Web

How to remove cookie notifications from screenshots

Cookie Notification Removal

With GDPR and various other privacy laws cookie notifications within web pages have become very common, however these notifications are usually not desirable within a screenshot.

GrabzIt can automatically remove common cookie notifications that appear within a web page, to do so just turn on the no cookie notifications feature as shown below.

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

ImageOptions options = new ImageOptions();
options.NoCookieNotifications = true;

grabzIt.URLToImage("http://www.google.com", options);
grabzIt.Save("http://www.mywebsite.com/Home/Handler");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

ImageOptions options = new ImageOptions();
options.setNoCookieNotifications(true);

grabzIt.URLToImage("http://www.google.com", options);
grabzIt.Save("http://www.mywebsite.com/handler");
<script src="https://cdn.jsdelivr.net/gh/GrabzIt/grabzit@js-3.2.9.8/javascript/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.google.com", {"nonotify":1}).Create();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

client.url_to_image("http://www.google.com", {"noCookieNotifications":true});
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
}); 	
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = GrabzItImageOptions->new();
$options->noCookieNotifications(1);
$grabzIt->URLToImage("http://www.google.com", $options);
$grabzIt->Save("http://www.mywebsite.com/handler.pl");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");

$options = new \GrabzIt\GrabzItImageOptions();
$options->setNoCookieNotifications(true);

$grabzIt->URLToImage("http://www.google.com", $options);
$grabzIt->Save("http://www.mywebsite.com/handler.php");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzItImageOptions.GrabzItImageOptions()
options.noCookieNotifications = True

grabzIt.URLToImage("http://www.google.com", options)
grabzIt.Save("http://www.mywebsite.com/handler.py")
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")

options = GrabzIt::ImageOptions.new()
options.noCookieNotifications = true

grabzIt.url_to_image("http://www.google.com", options)
grabzIt.save("http://www.mywebsite.com/handler/index")

If the cookie notification is not one of the common types that GrabzIt can remove we have the following four other techniques that can be used to try to remove them.

Hide the notification with cookies

Use the developer tools of your browser to see if there is a cookie added when a cookie notification is accepted. If there is add this to GrabzIt, this will then be used for all the future screenshots, suppressing the notification. Alternatively enable the user cookie behavior mode, which will automatically record all of the permanent browser cookies that are encountered during a capture.

Hide the HTML element

Another technique is to hide the unwanted page elements. To do this you need to find CSS selectors of the cookie notification element and then pass this to GrabzIt.

Create the capture from a non-EU country

The next option is to set the country parameter to the US, as this law is only relevant to the EU some websites won't show the notification if you take the screenshot from the United States.

Use a search engine user agent

Finally you can try setting the requestAs parameter to search engine. As some websites will not show cookie notifications if it thinks it's a search engine that is viewing the site.

Back to SupportMore Web Capture ArticlesCommunity Web Capture Questions
Try all our premium features for free with a 7 day free trial. Then from $5.99 a month, unless cancelled.
  • More Captures
  • More Features
  • More API's
  • Bigger Scrapes
  • Bigger Captures
  • Bigger Everything
Start Free Trial