How can we parse the request header in Java scipt to find out the protocol of the request, whether it is http or https?
Thanks in advance
In this case, I would think the Document object would be the relevant one. I don't see any method or property of the browser DOM that returns header information (besides the "mimeType" property).
If I'm wrong, someone please correct me. I think you'll need a server-side language for this.
If you simply want to check the URL, then yes, your technique should work.