![]() |
| ||
| Request Header Parsing in Javascript 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 Nivedita |
| ||
| Re: Request Header Parsing in Javascript To my knowledge, you can't use JavaScript for this. JavaScript has a limited set of core operators, statements, and objects. 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. |
| ||
| Re: Request Header Parsing in Javascript Just A Thought Here, Couldn't You Get The Referer With Javascript (like document.referer), and doesn't it return an entire URL? If this is so, couldn't you split the string (or use substr) and grap the protocol, and check for http: or https: and act accordingly? |
| ||
| Re: Request Header Parsing in Javascript That's what I get for reading posts too quickly. For some reason I had in mind the OP was asking if JavaScript could tell if the page was sent in response to a POST or GET header. If you simply want to check the URL, then yes, your technique should work. |
| All times are GMT -4. The time now is 3:17 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC