Detect browser TLS compatibility

后端 未结 5 1620
没有蜡笔的小新
没有蜡笔的小新 2021-02-01 04:08

We have a SSL website where the host has recently disabled older SSL protocols like TLS 1.0 and below. Depending on the browser, the site visitor gets a blank page or a cryptic

5条回答
  •  没有蜡笔的小新
    2021-02-01 04:48

    Indeed, you cannot check the TLS version. I had to load a script from a site which only supports TLS 1.2 (as opposed to my page). Using the simple HTML script tag would not give you any clue that the script was not loaded. As a result I ended up using following script to load JS from a different domain:  

    $.ajaxSetup({'cache':true});
    $.getScript('{scriptUrl}').done(function(){
       alert("done");
    }).fail(function( jqxhr, settings, exception ) {
        alert(jqxhr.status);
        alert(jqxhr.responseText);
        alert(exception);
    });
    

     

    In case of TLS problems the jqxhr.status will be 404 so you can display a message to the user.

提交回复
热议问题