प्रोटोकॉल वापस करने के लिए window.location ऑब्जेक्ट का उपयोग करें। विंडो .l ocation.protoco l वेब प्रोटोकॉल लौटाएगा यानी चाहे वह http . हो या https -
उदाहरण
<!DOCTYPE html>
<html>
<body>
<script>
document.write("https or https: <br>The protocol is:"+window.location.protocol);
</script>
</body>
</html>