Check if Safari block cookies "From third parties and advertisers" is enabled using javascript/php -


I am facing a problem that in my website payment gateway (MiGs) as an iframe in the Safari Browser Using the default cookie block is "by third parties and advertisers", so the gateway (migs) response is receiving a "cookie not enabled error" error. I would like to detect such a cookie block by using php / javascript to show this cookie block problem.

-

Edit:

I am facing a single problem, since the IOS7 "Block cookies from third parties" is disabled Stopping my LinkedIn social login button to work. In the lack of a solution, I'd love to know how they are enabled with Javascript or PHP + Lisovaccaro

I think one way of doing this is to have a script on another domain (no subdomain, but I have not tested it), which sets a cookie, and then the script can return JSONP so that You can use it on other domains with Javascript Can. So something like this:

PHP (cookie.php)

  & lt; Php header ("content-type: app / javascript"); Header ("Cash-Control: No-Store, No-Cash, Sure-Modified, Maximum-Age = 0"); Header ("cache-control: post-check = 0, pre-check = 0", false); Header ("Prestama: no-cache"); If (isset ($ _GET ["set"])) {// first run here setcookie ("cookie_test", "cookies", time () + 3600); // After redirecting the cookie, redirect yourself so that we do not need to call the script twice as headers ('location: cookies.fp? & Amp; amp; callback ='. '$ _GET ["callback"]; ); // death} // should be redirected once $ cookie_set = array ("cookies" => gt; isset ($ _COOKIE ["cookie_test"]); resonance @ $ _ GET ["callback"] "(" .json_encode ($ cookie_set). ");   

javascript / jquery

  // callback =? Jquery to know this jsonp Set to & Amp; so that script initiatives $ $ .getJSON be set ("http://another.domain.com/cookies.php?callback=?&set") .done (function) {if (data.cookies) {// third party cookies Enabled} other {// third party cookies are probably disabled}})   

. It was tested on Safari on map.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -