Sử dụng đối tượng window.location để trả về giao thức. Cửa sổ . l ocation.protoco Tôi sẽ trả về giao thức web, tức là có phải là http hoặc https -
Ví dụ
<!DOCTYPE html>
<html>
<body>
<script>
document.write("https or https: <br>The protocol is:"+window.location.protocol);
</script>
</body>
</html>