I've developed a standalone XULRunner app which I'm using as a browser. I'm not displaying the URL in the app. But I'd like to tell if the site accessed is using SSL (i.e., the URL starts with https://
). I'd like to display a message to the user if the section of the site they are in is secure or not. And, I guess the way to do it is by inspecting if a URL is using SSL or not. I've done some searches but no success so far, but I haven't given up. Any suggestions will be highly appreciated.
I've done some changes, and now my onSecurityChange()
method is shown below.
onSecurityChange: function(aWebProgress, aRequest, aState) {
if((aState & Components.interfaces.nsIWebProgress.STATE_IS_SECURE) == 0) {
document.getElementById("lblConnectionStatus").setAttribute("value", "Insecure Connection");
} else {
document.getElementById("lblConnectionStatus").setAttribute("value", "Secure Connection");
}
return 0;
}
However, it doesn't seem to change when I transition from insecure to secure pages. I've tried it with Yahoo and Hotmail, to see whether the problem is with the application I'm accessing, but there, too, it behaves the same.
Any pointer on what I may be doing wrong? Thanks in advance.