469,282 Members | 1,732 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

HTTPRequest denied permission

In Mozilla 1.4b, when the URL is set to a local URL, it works as expected.

function showIt(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "blank.html" ,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.myForm.outputSource.value = xmlhttp.responseText;
}
}
xmlhttp.send(null)
}

<form name="myForm" action="">
<textarea name="outputSource" rows="30" cols="40"></textarea>
</form>
If I change the blank.html to an online file, it gives me the error:

Error: uncaught exception: Permission denied to call method XMLHttpRequest.open

How do I make Mozilla allow permission to make the call?
--
Randy
Jul 20 '05 #1
3 4360

"HikksNotAtHome" <hi************@aol.com> schreef in bericht
news:20***************************@mb-m23.aol.com...

How do I make Mozilla allow permission to make the call?


You must sign your script, see:

http://www.mozilla.org/projects/secu...d-scripts.html
JW

Jul 20 '05 #2

"Janwillem Borleffs" <jw@jwscripts.com> schreef in bericht
news:3f*********************@news.wanadoo.nl...

http://www.mozilla.org/projects/secu...d-scripts.html


See also http://devedge.netscape.com/viewsour...nd-signatures/

Here you will also find a working link to the mentioned signtool
application.
JW

Jul 20 '05 #3


HikksNotAtHome wrote:
In Mozilla 1.4b, when the URL is set to a local URL, it works as expected.

function showIt(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "blank.html" ,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.myForm.outputSource.value = xmlhttp.responseText;
}
}
xmlhttp.send(null)
}

<form name="myForm" action="">
<textarea name="outputSource" rows="30" cols="40"></textarea>
</form>
If I change the blank.html to an online file, it gives me the error:

Error: uncaught exception: Permission denied to call method XMLHttpRequest.open

How do I make Mozilla allow permission to make the call?


If your script is in a HTML file loaded via file: URL from the local
file system then you can try to request permission from the browser user
(which is probably you as the file is loaded locally):

var httpRequest = new XMLHttpRequest();
if (typeof netscape != 'undefined' && typeof netscape.security !=
'undefined') {
try {

netscape.security.PrivilegeManager.enablePrivilege ('UniversalBrowserRead');
httpRequest.open('GET', 'http://javascript.faqts.com/', true);
httpRequest.onreadystatechange = function (evt) {
if (httpRequest.readyState == 4) {
alert(httpRequest.responseText);
}
};
httpRequest.send(null);
}
catch (e) {
alert('Error ' + e.message + ' occurred.');
}
}

The same code can be used in a page loaded via HTTP but then with the
normal security settings the enablePrivilege call fails silently unless
the script is signed. Event then the browser used will be asked to grant
permission.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Randy Webb | last post: by
1 post views Thread by Mark E. Hamilton | last post: by
2 posts views Thread by Taishi | last post: by
3 posts views Thread by David Thielen | last post: by
reply views Thread by private.anders | last post: by
reply views Thread by private.anders | last post: by
4 posts views Thread by xzzy | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.