← All examples

JavaScript Ads & clutter canva.com

Auto-close Pro dialogs

A script detects Canva Pro upsell dialogs and clicks their own close button.

Code to copy

try {
  var check = function () {
    var dialogs = document.querySelectorAll('[role="dialog"]');
    dialogs.forEach(function (d) {
      var label = (d.getAttribute('aria-label') || '').toLowerCase();
      var txt = (d.textContent || '').toLowerCase();
      if (label.indexOf('upgrade') > -1 ||
          txt.indexOf('upgrade to canva pro') > -1) {
        var btn = d.querySelector('[aria-label*="Close" i],[aria-label*="Dismiss" i]');
        if (btn) { btn.click(); }
      }
    });
  };
  check();
  var mo = new MutationObserver(check);
  if (document.body) {
    mo.observe(document.body, { childList: true, subtree: true });
  }
} catch (e) {
  console.warn('Canva pro dialog auto-close failed:', e);
}

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases