Hi all,
I’ve just implemented a script on my site to enable users to login via a small form rather than using the lame popup box that is usually used for .htaccess protected directories.
Does anyone know if there’s a reason this isn’t working in IE? It works ok in FF and I’m pretty sure there’s nothing wrong with the code cos it’s a popular snippet and pretty much the only one available on most script sites that can do this. I’m quite sure it’s one of the two lines in bold that isn’t working right:
[I](I just get an error in IE and the page does nothing, but in FF it jumps to the specified page.)
[CODE]<!– Begin
function login(form)
{
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server)
{
[B]var htsite = “http://” + username + “:” + password + “@” + server;
window.location.href = htsite;[/B]
}
else
{
alert(“Please enter your username and password.”);
}
}
// End –>
<form name=form1>
<!– The hidden form field “server” needs to be the address of your password protected directory. –>
<input type=”hidden” name=”server” value=”www.utilitiessolutions.pwp.blueyonder.co.uk/agent/”>
<b>Username:</b>
<input type=text name=username size=20 style=”font-size: 12px”>
<b>Password:</b>
<input type=password name=password size=20 style=”font-size: 12px”>
<input type=button name=”button”value=”login” onClick=”login(this.form)” style=”font-size: 10px”>
</form>
I think it may be due to a security update at some point along the line – but any help is much appreciated, as I’m no expert coder myself. :rolleyes: and I’d rather get this sorted than have to resort to a server-side solution.
Thanks all, Drew
[URL=”http://www.utilitiessolutions.co.uk”]Utilities Solutions – Business Electricity, Gas & Telecoms