By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,728 Members | 2,480 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,728 IT Pros & Developers. It's quick & easy.

HTTPRequest denied permission

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a

"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

P: n/a

"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

P: n/a


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.