I used the following Javascript to password protect my webpage but it’s not working for IE, although it works fine for Chrome and Firefox.
<script language="JavaScript">
var password;
var pass1="PASSWORD-HERE";
password=prompt('Whats The Magic Word?',' ');
if (password==pass1) alert('That Is Correct!');
else {
window.location="SITE-LINK";
}
</script>
What is wrong?
Please check out the link: http://www.xuanyinwen.com/test3.html
it work on Firefox and chrome but not IE, when you open the link in IE, it got no message pot up asking for the password, and will automatic go to SITE-LINK.
I know this script is not very secure, but I just want use it for a basic protect, just want make it work. thanks for any help!
Try this:
The difference is that you are setting the
hrefproperty instead.btw I tested this in IE9 beta and it works.