• Resolved redwolfmendoza

    (@redwolfmendoza)


    We’ve been troubleshooting an issue that’s been reported by our EU visitors. Clicking on OK in the consent dialog opens a new tab with a blank page and is disorienting. Sometimes the page title reads “javascript: void(0)”.

    This can be found in the markup for the button:
    (a tabindex=”0″ id=”CybotCookiebotDialogBodyLevelButtonAccept” lang=”en” href=”javascript: void(0);”) OK (/a)

    So far I’ve found these forums explaining that the best way to remedy the issue is to have the href be ‘return false’ instead of ‘void(0)’:

    https://stackoverflow.com/questions/17094413/javascriptvoid0-and-target-blank-behaviour
    https://www.quora.com/How-do-you-fix-the-javascript-void-0-error

    Are there any plans for a future fix for this issue? It mainly seems to affect Win10 Microsoft Edge, but can also be seen on Win10 Firefox. Win10 chrome seems fine.

    • This topic was modified 5 years, 11 months ago by redwolfmendoza.
    • This topic was modified 5 years, 11 months ago by redwolfmendoza. Reason: fixed markup for consent button

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author cookiebot

    (@cookiebot)

    Hi @redwolfmendoza,

    Thanks for reaching out!

    Most often, the issue is not with Cookiebot, but scripts on customers sites that are interfering with the click event of the OK button.

    By inspecting the OK button on your website, in Chrome Developer, we found that my.min.js has a click event attached to the button.

    See:

    https://prnt.sc/nah8mv

    By further inspecting my.min.js, there is the following code:

    $("a").each(function() {
      new RegExp("/" + window.location.host + "/").test(this.href) || $(this).click(function(a) {
        a.preventDefault(), a.stopPropagation(), window.open(this.href, "_blank")
      })
    })

    This is what is causing the issue. You should check with your developer to find a solution.

    Regards

    • This reply was modified 5 years, 11 months ago by cookiebot.
    Thread Starter redwolfmendoza

    (@redwolfmendoza)

    Thanks for the quick reply! We will try to exclude the Cookiebot consent button from this event handler (by ‘id’) going forward.

    We’ve also have had some success using the ‘defer’ setting on the Consent banner script tag (Cookiebot > Settings > ‘Add async or defer attribute
    Consent banner script tag’).

    It is possible that our EU visitors are experiencing some issues with the load order of their scripts when visiting the site(s) and that also may be interfering with the consent button functionality. So, deferring the script seems to help.

    Thanks again!

    Plugin Author cookiebot

    (@cookiebot)

    It is possible that our EU visitors are experiencing some issues with the load order of their scripts when visiting the site(s) and that also may be interfering with the consent button functionality. So, deferring the script seems to help.

    We haven’t experienced that before, but if it works for you then great!

    Have a nice day ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘OK button ‘javascript: void(0)’ opens New tab’ is closed to new replies.