Connecting Tech Pros Worldwide Forums | Help | Site Map

HTTPRequest denied permission

HikksNotAtHome
Guest
 
Posts: n/a
#1: Jul 20 '05
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

Janwillem Borleffs
Guest
 
Posts: n/a
#2: Jul 20 '05

re: HTTPRequest denied permission



"HikksNotAtHome" <hikksnotathome@aol.com> schreef in bericht
news:20031224151148.02537.00002191@mb-m23.aol.com...[color=blue]
>
> How do I make Mozilla allow permission to make the call?[/color]

You must sign your script, see:

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


JW



Janwillem Borleffs
Guest
 
Posts: n/a
#3: Jul 20 '05

re: HTTPRequest denied permission



"Janwillem Borleffs" <jw@jwscripts.com> schreef in bericht
news:3fea3e10$0$196$1b62eedf@news.wanadoo.nl...[color=blue]
>
> http://www.mozilla.org/projects/secu...d-scripts.html
>
>[/color]

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

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


JW



Martin Honnen
Guest
 
Posts: n/a
#4: Jul 20 '05

re: HTTPRequest denied permission




HikksNotAtHome wrote:[color=blue]
> 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?[/color]

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/

Closed Thread