Modified code
I have added 'thirdEnable' variable in the script. sample code : window._3rd_party_test_step1_loaded = function(){ // At this point, a third-party domain has now attempted to set a cookie (if all went to plan!) var step2Url = 'http://aneesht.in/step2.js.php', resultsEl = document.getElementById('3rd_party_cookie_test_results'), step2El = document.createElement('script'); // And load the second part of the test (reading the cookie) step2El.setAttribute('src', step2Url); resultsEl.appendChild(step2El); } window._3rd_party_test_step2_loaded = function(cookieSuccess){ if(cookieSuccess){ //Third party cookies are functioning in your browser thirdEnable = 'true'; } else{ //Third party cookies appear to be disabled thirdEnable = 'false'; } if(thirdEnable == 'true') // do something }