Current page protocol
JavaScript, Browser · Oct 20, 2020

Gets the protocol being used on the current page.
- Use
Window.location.protocol
to get the protocol (http:
orhttps:
) of the current page.
const getProtocol = () => window.location.protocol;
getProtocol(); // 'https:'