প্রোটোকল পেতে window.location অবজেক্ট ব্যবহার করা হয়। window.location.protocol ওয়েব প্রোটোকল রিটার্ন করে অর্থাৎ এটি http নাকি https।
উদাহরণ
<!DOCTYPE html> <html> <body> <script> document.write("https or https: <br>The protocol is:"+window.location.protocol); </script> </body> </html>