Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can a page tell if it's being seen HTTPS?

Status
Not open for further replies.

EdwardMartinIII

Technical User
Sep 17, 2002
1,655
US
I have a form for collecting and sending data.

The site links to the HTTPS form of the page, but someone COULD just deliberately enter the page's URL into the browser.

Our site is a collection of static HTML pages right now.

Is there a way of determining whether or not the user is viewing that page as an https page, and further, is there a way to, say, disable the submission of the document if the page is simply being viewed under HTTP?

Thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
document.location.protocol should tell you if it is HTTP or HTTPS, but bear in mind that client side scripts can be amended by the end user - e.g. they save the page, change your Javascript then reload the page and submit the form.

The best way to do this is probably have your server ONLY serve HTTPS for that part of your site and then redirect requests for HTTP to HTTPS to cover all bases.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
Ah, being able to apply that amount of control from the server would be perfect. Can you explain how I might do that, or direct me to a tutorial?


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
With HTML (this being the HTML section) no there isn't, server-side however; there are quite a few ways to check by inspecting the environment variables.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
It would all depend on what server is being used (apache, IIe, Somthing else) & any serverside applications being run.

you will need to report in the apropriat forum to get the best response


I do not Have A.D.D. im just easily, Hey look a Squirrel!
 
I'm hosting on an Apache site, Dreamhost, specifically.

If you can direct me to a more specific forum, I'd be most grateful.

Thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
I'm hosting on an Apache site, Dreamhost, specifically.
the Apache forum sounds like a good start point.


I do not Have A.D.D. im just easily, Hey look a Squirrel!
 
Cool, thanks!


[monkey] Edward [monkey]

"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top