• window.consentApi.unblock: Check if a given URL / string is blocked by a Content Blocker:

    • When a Content Blocker exists, the Promise is only resolved after given consent
    • When no Content Blocker exists, the Promise is immediate resolved

    Example (ES5):

    (window.consentApi && window.consentApi.unblock("player.vimeo.com") || Promise.resolve()).then(function() {
    console.log("Consent for Vimeo given, unlock content...!");
    });

    Example (ES6, TS):

    (window.consentApi?.unblock("player.vimeo.com") || Promise.resolve()).then(() => {
    console.log("Consent for Vimeo given, unlock content...!");
    });

    Since v5.0.4: The API also supports passing an HTMLElement as the first argument. When the element is blocked, the returned Promise is resolved immediately after unblocking:

    window.consentApi.unblock(document.querySelector("iframe")).then(() => console.log("I got loaded!"));
    

    Parameters

    • blocker: BlockerDefinition[]
    • urlOrElement: string | HTMLElement
    • Optional options: Options

    Returns Promise<void>