In a webpage URL, the protocol (i.e.
https:) is the standard that specifies how data is transferred and transmitted amongst computers.
Window interface has access to the
Location object that can be used via
Here's what the method looks like in practice:
This will return a USVString representing the protocol scheme of the current page's URL with the
And here are some examples of what values it can return:
// "http:" // "https:" // "file:" // "ftp:" // "mailto:"
For more information on the browser support for this method, see its MDN web docs page.
Thanks for reading and happy coding!