• Resolved Salvatore Noschese

    (@salvatorenoschese)


    hi, I use this in my website (button manage cookies in footer)

    <?php
    /**
    * Show the banner when a html element with class 'cmplz-show-banner' is clicked
    */

    defined( 'ABSPATH' ) || exit;
    add_action( 'wp_footer', 'cmplz_show_banner_on_click' );
    function cmplz_show_banner_on_click() {
    ?>
    <script>
    function addEvent(event, selector, callback, context) {
    document.addEventListener(event, e => {
    if ( e.target.closest(selector) ) {
    callback(e);
    }
    });
    }
    addEvent('click', '.cmplz-show-banner', function(){
    document.querySelectorAll('.cmplz-manage-consent').forEach(obj => {
    obj.click();
    });
    });
    </script>
    <?php
    }

    and work as expected, but cannot work if I enable respect dnt and dnt is enabled in browser (onclick, just do nothing).

    can u help me to make a redirect onclick if dnt in browser and respect dnt are enabled?

    I can check complianz setting with this:

    <?php if (cmplz_get_option('respect_dnt') !== 'no') : ?>

    but cannot found a valid way to check also browser setting.

    ty.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.