Window.location.protocol
to get the protocol (http:
or https:
) of the current page.const getProtocol = () => window.location.protocol;
getProtocol(); // 'https:'
Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️