Get a Free Trial

How to disable JavaScript inline popups?

Some web pages contain unwanted inline JavaScript popups that appear in screenshots generated with our API's and Online Screenshot Tool. The most reliable technique to hide these popups is to specify the HTML elements of the popup to hide. Below is the HTML snippet of a inline popup we want to remove.

<div class="ArevicoModal-bg ArevicoModal-iframe" style="display: block;"></div>
<div class="ArevicoModal ArevicoModal-iframe" style="display: block;">
 <div class="ArevicoModal-content">
  <span class="ArevicoModal-close-icon ArevicoModal-close"></span>
  <div id="arvlbdata" style="overflow:visible;width:400px;height:250px;" class="ArevicoModal-inner">
   <h2>Sign up now!!</h2>
  </div>
 </div>
</div>

Therefore to remove this popup we need to hide all the popup elements that are blocking the page using the elements CSS selectors. In this case it is .ArevicoModal-bg and .ArevicoModal. You can find out what HTML elements you need to remove by using the developer tools of your web browser. An example of hiding the .ArevicoModal-bg and .ArevicoModal HTML elements are shown for each API below.

//The client should be stored somewhere and reused!
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret", client);
ImageOptions options = new ImageOptions();
options.HideElement = ".ArevicoModal-bg,.ArevicoModal";
grabzIt.URLToImage("http://www.bbc.com", options);
await grabzIt.SaveToAsync("bbc.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.hideElement(".ArevicoModal-bg,.ArevicoModal");
grabzIt.URLToImage("http://www.bbc.com", options);
grabzIt.SaveTo("bbc.jpg");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.5.2/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("http://www.bbc.com", 
	{"hide", ".ArevicoModal-bg,.ArevicoModal"}).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.bbc.com", 
	{"hideElement", ".ArevicoModal-bg,.ArevicoModal"});
client.save_to("bbc.jpg", 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->hideElement(".ArevicoModal-bg,.ArevicoModal");
$grabzIt->URLToImage("http://www.bbc.com", $options);
$grabzIt->SaveTo("bbc.jpg");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItImageOptions();
$options->setHideElement(".ArevicoModal-bg,.ArevicoModal");
$grabzIt->URLToImage("http://www.bbc.com", $options);
$grabzIt->SaveTo("bbc.jpg");
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItImageOptions.GrabzItImageOptions()
options.hideElement = ".ArevicoModal-bg,.ArevicoModal"
grabzIt.URLToImage("http://www.bbc.com", options)
grabzIt.SaveTo("bbc.jpg")
https://api.grabz.it/convert?key=Sign in to view your Application Key&format=jpg&hide=.ArevicoModal-bg%2C.ArevicoModal&url=https%3A%2F%2Fwww.bbc.com%2F
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::ImageOptions.new()
options.hideElement = ".ArevicoModal-bg,.ArevicoModal"
grabzIt.url_to_image("http://www.bbc.com", options)
grabzIt.save_to("bbc.jpg")

Other Techniques

Some popups are controlled with cookies, therefore if you set the correct cookie value for that domain the popup may no longer appear. This can be done manually or automatically by enabling the user cookie behavior mode.

To do this visit the web page and open your browser's developer tools facility so that you can see what cookies are present on the web page. Now close the popup. If a new cookie appears refresh the page. If the popup no longer appears copy the details of the cookie that appeared and add it to your custom cookies. However it would be a good idea to give it a long expiry date perhaps 10 years in the future so that the cookie isn't deleted.

Another potential solution is to request captures using the search engine user agent, by setting the "request as" parameter. Depending on how the website was written it may cause the pop-up not to appear.