/    Sign up×
Community /Pin to ProfileBookmark

Refreshing an http: URL into an https: URL and back again.

I’m not sure how possible this is, but I’ll try to explain it in case:

I’ve got a of 100+ page website which is mirrored both on a normal http server, and an https: secure server.

Placing the whole site on a secure server was particularly useful for the log in areas (as a range of confidential client information is presented in those areas, with the option to add medical notes, etc..) as it worked out, it was easier to put the whole thing on secure so even just the normal index page can be viewed securely.

As people have the option to fill in a contact form on every page, I wanted to give them the option to view this on the secure server, with a small padlock icon on each page (in case they’re concerned about sending info un-securely).

By clicking on the padlock, I was hoping there would be some way the whole URL could refresh (without loosing the current sub directory and file location) but just refresh with the base of the URL as https: or http: accordingly.
The bulk of the page is set up on a page template which is referenced externally (ie so I only have to update one template to change the layout of the site) so this is where I was hoping the secure padlock, (hence it’s not really practical to put a unique secure link on every page).

I didn’t want to put the whole site purely as https: by default, as some users within companies have a ban on accessing secure pages while they’re at work. Similarly, there seems to be something on the page with IE regards as insecure (even though if you ask it not to display the un-secure items, nothing is missing on the page) so you get an annoying popup prompt each time a page is viewed.

The site address is http:[url]www.therapy-agency.co.uk[/url] (if this helps_ and I’d appreciate any ideas you had on how to help this function!

Jason

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@TageOct 13.2004 — If you have a server-side scripting language available (which it sounds like you do), it might be better (if it's possible) to use that to output which one (http/https) to use on that page. You should almost always (if not always) look for a solution on the server-side first. If you want to use javascript however...here's one way to do it with javascript...<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
function changeSecurity(){
var temp=document.location.href;
if(temp.substring(0,5)=="https")
document.location.href="http"+temp.substring(5,temp.length);
else
document.location.href="https"+temp.substring(4,temp.length);
}
//-->
</script>
</head>
<body>
<button onClick="changeSecurity()">Change Security</button>
</body>
</html>
Copy linkTweet thisAlerts:
@happy_handsauthorOct 13.2004 — Thanks Tage,

I'll give that a go, and thank you for putting it together for me. I take it this would work with an external js file too? (as we have a few things running in those already).

Regarding doing it server side, I'd love to, unfortunately though I don't know how to do it in the language the programmers have used. Apparently they've developed their own server platform on which to run all the server side scripting, so I'm assuming it's not PHP, etc and I wouldn't know where to start! ?


If I was to have a little icon of a padlock on the page (which was open if un-secure, and closed if secure) instead of the button, would there be some sort of 'if' 'else' statement within the body to reference a gif image? Or is this server side stuff?
×

Success!

Help @happy_hands spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...