H
hpatel
Hi,
I maintain a website for my organization. Recently, for a login page,
I started using HTTPS. It works fine with HTTPS.
The problem I face is : When a user goes to login page, he sees the
login page via HTTPS. Now, if user doesn't submit the login form but
chooses to browse some other link on the same page, that page will
still be shown using HTTPS because links are relative. This increases
unnecessary HTTPS traffic on the server.
I need a solution that can help me to change protocol back to HTTP if
the user doesn't submit login form. I have written small piece of
java script that can check at the time of leaving the page. If submit
button wasn't pressed, it should change the protocol back to HTTP. I
have played around window.location object trying to change it's href
property.
<code>
window.onunload = function()
{
// if submit button wasn't pressed, change the protocol back to
HTTP
if (!submitPressed)
{
window.location.protocol="http:";
alert(windows.location.href);
window.location.port = "80";
}
</code>
Please let me know if you know about some simple solution.
I maintain a website for my organization. Recently, for a login page,
I started using HTTPS. It works fine with HTTPS.
The problem I face is : When a user goes to login page, he sees the
login page via HTTPS. Now, if user doesn't submit the login form but
chooses to browse some other link on the same page, that page will
still be shown using HTTPS because links are relative. This increases
unnecessary HTTPS traffic on the server.
I need a solution that can help me to change protocol back to HTTP if
the user doesn't submit login form. I have written small piece of
java script that can check at the time of leaving the page. If submit
button wasn't pressed, it should change the protocol back to HTTP. I
have played around window.location object trying to change it's href
property.
<code>
window.onunload = function()
{
// if submit button wasn't pressed, change the protocol back to
HTTP
if (!submitPressed)
{
window.location.protocol="http:";
alert(windows.location.href);
window.location.port = "80";
}
</code>
Please let me know if you know about some simple solution.