JSFiddle - React, Tailwind, and code Playground
by Firdaus Zailani
JavaScript
$.getJSON("http://mfirdaus.net/random/so/cookies.php?callback=?&set").
done(function(data){
if(data.cookies){
alert('third party cookies enabled')
} else {
alert('third party cookies disabled')
}
})
/* cookies.php:
<?php
header("Content-type: application/javascript");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if(isset($_GET["set"])){
setcookie("cookie_test","cookies",time()+3600);
header('Location: cookies.php?&callback='.@$_GET["callback"]);
die();
}
$cookie_set=array("cookies"=>isset($_COOKIE["cookie_test"]));
echo @$_GET["callback"]. "(" . json_encode($cookie_set) . ")";
*/