Password Proection in Firefox over IE

Soldato
Joined
17 Jan 2006
Posts
2,890
Location
Dundee
Hi I hope someone out there can answer this, but I have develepoed a very small website for access to online online storage of some data and is password protected but does not work properly with Firefox only IE.

I am using this Javascript :

<script>
// Author: Schubert(16) - [email protected]
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
function ask()
{
pass=prompt("This portal is password protected. Enter the password below. ","");
if(pass=="Password" && pass!=null)
{
alert("Correct password. Access granted");
}
else
{
alert("Incorrect password. Access denied")
history.back(1);
}


}
window.onload=ask
//stop-->
</script>

This work a treat but does not work with Firefox. Even if you enter a wrong password is will display the erro but remain on the page and not go back to the previos one. Is there a command that I can use to redirect it to a particular page instead of back and will work with both browsers.

Dont really wanty to go to the hassle of PHP.

Not really my strong point I concentrate on Networks (3rd Degree Student), but have not done JavaScript or CSS/HTML. I use Frontpage 2003.
 
KingAdora said:
You do realise that even if you get this to work - people can just view the source and see what the password is?

Thank you for that

Will look at PHP, is that the best way to do it

Cheers
 
KingAdora said:
You do realise that even if you get this to work - people can just view the source and see what the password is?


UPDATE:

Just tried it and the first thing the page does when it loads is to run the Javascript command and therefore you cannot right click to view the source.
 
Berserker said:
Simple. You don't need a web browser to download and view HTML source code. Unless you're prepared to spend lots of time on encryption and whatever, almost anything you do to stop people viewing the source code from a web browser is futile.

Cheers

Got a mate with a BSC(Hons) in Software Develpoment. I did his home network, so he can do my Secure Site !!!

I Hope

Cheers to everyone with thier ideas.
 
Back
Top Bottom