Files
30-seconds-of-code/snippets/getProtocol.md
Angelos Chalaris 8a6b73bd0c Update covers
2023-02-16 22:24:28 +02:00

395 B

title, tags, cover, firstSeen, lastUpdated
title tags cover firstSeen lastUpdated
Current page protocol browser bamboo-lamp 2020-10-07T01:40:53+03:00 2020-10-20T11:46:23+03:00

Gets the protocol being used on the current page.

  • Use Window.location.protocol to get the protocol (http: or https:) of the current page.
const getProtocol = () => window.location.protocol;
getProtocol(); // 'https:'