Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 302 Bytes

getProtocol.md

File metadata and controls

16 lines (12 loc) · 302 Bytes
title tags
getProtocol
browser,beginner

Returns 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:'