Computer Science, asked by honeyPriyanshu7510, 1 year ago

How to return the protocol (http or https) of the web page with JavaScript?

Answers

Answered by blasticurita
1

Use the window.location object to return the protocol. The window.location.protocol will return the web protocol i.e. whether it’s http or https:

<!DOCTYPE html>

<html>

  <body>

     <script>

        document.write("https or https: <br>The protocol is:"+window.location.protocol);

     </script>

  </body>

</html>

Similar questions