User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 363,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,872 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 9664 | Replies: 3
Reply
Join Date: Mar 2005
Posts: 1
Reputation: nivedita is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nivedita nivedita is offline Offline
Newbie Poster

Request Header Parsing in Javascript

  #1  
Mar 30th, 2005
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Request Header Parsing in Javascript

  #2  
Mar 30th, 2005
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.
Reply With Quote  
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 107
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: Request Header Parsing in Javascript

  #3  
Mar 31st, 2005
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?
Reply With Quote  
Join Date: Dec 2004
Posts: 1,589
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 34
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Request Header Parsing in Javascript

  #4  
Mar 31st, 2005
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:08 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC