Click to See Complete Forum and Search --> : Sniff out Secure Server


jennAshton
06-12-2003, 05:00 PM
Is there a way to use javascript to sniff out whether users are coming from a secure server? I would like to serve a different css if they are coming from https.

Thanks,

Jenn

brendandonhue
06-12-2003, 05:23 PM
Heres something to start off with
alert(document.protocol)
Will tell you the protocol of the document.
Maybe you could say
if (document.protocol="Secure HpyerText Transfer Protocol")
{do this}
else {do this}

jennAshton
06-12-2003, 06:46 PM
document.protocol only works in IE 3.2 I think... Thanks for replying so fast.

brendandonhue
06-12-2003, 07:39 PM
Huh?
document.protocol is standard javascript.

Charles
06-12-2003, 09:00 PM
Originally posted by brendandonhue
document.protocol is standard javascript. It's not a part of the ECMA 262 specification (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html); it's not a part of the JavaScript 1.3 specification (http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/document.html) and it's not a part of the W3C DOM specification (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-26809268).