We help IT Professionals succeed at work.

IE (not FF) complains

Syllables
Syllables asked
on
278 Views
Last Modified: 2008-06-16
The following function:throws an invalid argument in IE7 when called, but FF performs perfectly. IE reports the error at character 1 of the window.location... line

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Login(form) {
var username = form.username.value;
var password = form.password.value;
var server = form.server.value;
if (username && password && server) {
var htsite = "http://" + username + ":" + password + "@" + "www.mysite.com/members/";
window.location = htsite
}
else {
alert("Please enter your username and password.");
   }
}
//  End -->
</script>
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
Hi

use location.href instead of window.location

Regards
Sathish


*** adverts removed, mplungjan, ee page editor ***

Author

Commented:
Yup, appears as if URLs of the form
http://username:password@...
are invalid to IE7. What incredibly bad manners.
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
PS: changing location.href has the same effect as changing window.location
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.