Archives for: March 2008, 17

Javascript Recipe - Redirect http to secure https URLs on the fly

03/17/08 | by admin [mail] | Categories: Nerd Thoughts

This code, when embedded in your HTML page, will automatically redirect visitors to the secure version of your page provided that SSL is set up on your server. The code requires no customization. It does not pass along request variables so you should use this on your “secure form” page.

Code:

<script language="JavaScript">
loc=top.location.href;
if(! loc.match(/^https/)){
loc=loc.replace(/^http:/,"https:");
top.location.href=loc;
}
</script>

Of course, ensuring your form data is encrypted on its way to storage or a recipient is another story. I’ll post how to do that if anyone asks.

Matthew Steven's Thought Box

Matthew Steven is a lifelong technology enthusiast. He has been in the business of creating ecommerce web applications, solving problems on UNIX platforms, and hosting servers since the earliest days of the internet. He is active in community service, plays classical guitar, and has a number of furry children.

March 2008
Sun Mon Tue Wed Thu Fri Sat
 << < Current> >>
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31        

Linkblog

b2evolution

  • Matt's Org

    Dig the dirt on Matthew Steven at his homepage.

    Permalink

Misc

XML Feeds

What is RSS?

powered by b2evolution free blog software