Title: OK button &#8216;javascript: void(0)&#8217; opens New tab
Last modified: April 10, 2019

---

# OK button ‘javascript: void(0)’ opens New tab

 *  Resolved [redwolfmendoza](https://wordpress.org/support/users/redwolfmendoza/)
 * (@redwolfmendoza)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/ok-button-javascript-void0-opens-new-tab/)
 * 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://stackoverflow.com/questions/17094413/javascriptvoid0-and-target-blank-behaviour)
   –
   [https://www.quora.com/How-do-you-fix-the-javascript-void-0-error](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 7 years, 1 month ago by [redwolfmendoza](https://wordpress.org/support/users/redwolfmendoza/).
    -  This topic was modified 7 years, 1 month ago by [redwolfmendoza](https://wordpress.org/support/users/redwolfmendoza/).
      Reason: fixed markup for consent button
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fok-button-javascript-void0-opens-new-tab%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [cookiebot](https://wordpress.org/support/users/cookiebot/)
 * (@cookiebot)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/ok-button-javascript-void0-opens-new-tab/#post-11416243)
 * Hi [@redwolfmendoza](https://wordpress.org/support/users/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](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 7 years, 1 month ago by [cookiebot](https://wordpress.org/support/users/cookiebot/).
 *  Thread Starter [redwolfmendoza](https://wordpress.org/support/users/redwolfmendoza/)
 * (@redwolfmendoza)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/ok-button-javascript-void0-opens-new-tab/#post-11418151)
 * 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!
    -  This reply was modified 7 years, 1 month ago by [redwolfmendoza](https://wordpress.org/support/users/redwolfmendoza/).
 *  Plugin Author [cookiebot](https://wordpress.org/support/users/cookiebot/)
 * (@cookiebot)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/ok-button-javascript-void0-opens-new-tab/#post-11418738)
 * > 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.

 * ![](https://ps.w.org/cookiebot/assets/icon.svg?rev=3200631)
 * [Cookiebot by Usercentrics - Automatic Cookie Banner for GDPR/CCPA & Google Consent Mode](https://wordpress.org/plugins/cookiebot/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookiebot/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookiebot/)
 * [Active Topics](https://wordpress.org/support/plugin/cookiebot/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookiebot/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookiebot/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [cookiebot](https://wordpress.org/support/users/cookiebot/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/ok-button-javascript-void0-opens-new-tab/#post-11418738)
 * Status: resolved