/spooky-cookie

service to detect 3rd-party cookies support

Primary LanguageJavaScript

spooky-cookie

Service to detect 3rd-party cookies support.
Running on heroku spooky-cookie.herokuapp.com, http and https.

usage

Page's head should have http/https detection script <script src="https://spooky-cookie.herokuapp.com"> </script>. Callback function should be defined function spookyCookie(areSupported) {..} - will receive true if 3rd party cookies are supported

example

Code injectes a feature-detection script and callback function what sets a feature-class like modernizer.

(function detect(){
	var spookyCookieService = "spooky-cookie.herokuapp.com";
	window.spookyCookie = function(gotCookie){
		gotCookie && $('html').addClass('cookie-3rd-support');
		/* or your code */
	};
	var script = document.createElement('script');
	script.src = (('https:' == document.location.protocol) ? "https://" : "http://") + spookyCookieService;
	var head = document.getElementsByTagName('head')[0];
	head.appendChild(script);
})();