...

View Full Version : Window.onload = function FF3



Eben
06-26-2009, 05:33 PM
hi,

i have a short js code that auto login me to password protected http folder,
it seems that the function window.onload = function doesn't work in FF3,

here's the code:


<HTML>
<HEAD>
<SCRIPT language="javascript">
var username='user';
var password='password';
var url='http://secureserver.com/private';
function getHTTPObject() {
if (typeof XMLHttpRequest != 'undefined') {
return new XMLHttpRequest();
}
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
return false;
}


window.onload = function() {
var http = getHTTPObject();
if (http && this.url && this.username && this.password) {
http.open("GET", this.url, false, this.username, this.password);
http.send("");
if (http.status == 200) {
document.location = url;

} else {
alert("Incorrect username and/or password.");
}
} else{
alert('Incorect use of the httpauthredirect function');
}
return false;
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Trying to authenticate, please wait</H1>
</BODY>
</HTML>

Can someone help me with this?

abduraooft
06-26-2009, 05:38 PM
Get a copy of firebug (http://getfirebug.com), if you don't have one and check the error console to see if there is any error.

Eben
06-26-2009, 05:47 PM
it seems like it's disable for security reasons:


Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: " ... Line: 25"]

is there any idea how to overcome this?

eak
06-26-2009, 05:52 PM
Are you trying to access an external domain? You can't do that with JS (yet).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum