http://stackoverflow.com/questions/5154596/is-sni-actually-used-and-supported-in-browsers
var redirect='http://REPLACE_WITH_NON_SNI_URL'; var sni_https_timeout, sni_http_timeout; var https_req = $.ajax({ url : 'https://SNI_TEST_DOMAIN.com/snitest.php', dataType : "jsonp", }).done(function() { window.clearTimeout(sni_https_timeout); var request = $.ajax({ url: "index.php?ua=sni_check_done", type: "POST" }); }) sni_https_timeout = window.setTimeout(function() { var http_req = $.ajax({ url : 'http://SNI_TEST_DOMAIN/sni_healthcheck.php', dataType : "jsonp" }).done(function() { window.clearTimeout(sni_http_timeout); window.setTimeout(function() { window.location = redirect; }, 200); }); sni_http_timeout = window.setTimeout(function() { sni_http_fail(); }, 8000); }, 8000); function sni_http_fail() { var request = $.ajax({ url: "index.php?ua=sni_check_done", type: "POST" }); }
snitest.php / sni_healthcheck.php:
<?php if (array_key_exists('callback', $_GET)) { header( 'Content-type: application/javascript' ); echo "{$_GET['callback']}();\n"; }