PDA

View Full Version : Password protect a webpage on any host



unleashed
02-14-2008, 09:50 AM
Password protect a webpage on any host
As we know that many freehosts don`t allow password protecting pages
Lets password protect a page ourselves using a simple javascript smile.gif

Now we suppose my page`s html code is the following:-

<html>
<head>
<title>Testing Password</title>
</head>
<body>
<b>This was just a test</b>
</body>
</html>

Now we need to modify the code a bit to add the script.
Modify the above code like this:-


<html>
<head>
<title>Testing Password</title>
</head>
<body>
<script language="javascript">
var a = prompt("Enter the password to access this page")
if (a=="YourPasswordHere"){alert("Permission Granted");}
else{alert("Sorry, Wrong password.\n\nPlease try again.");location.reload();}
</script>
<b>This was just a test</b>
</body>
</html>

And just save it

DON`T FORGET TO CHANGE "YourPasswordHere" WITH YOUR PASSWORD


--------------------

raghunathj
08-29-2008, 04:48 AM
well we can see the password by clicking on view source

JOHNS
08-29-2008, 07:43 AM
ya, raghunath. that's my doubt too

Ganesh
08-29-2008, 01:06 PM
yep dats true ^^^^^^^^^ :iagree:
!!!!™

gamesbond
09-05-2008, 07:30 PM
doubt!!!!!!!!!!!!