HTTPRequest denied permission

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • HikksNotAtHome

    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("G ET", "blank.html " ,true);
    xmlhttp.onready statechange=fun ction() {
    if (xmlhttp.readyS tate==4) {
    document.myForm .outputSource.v alue = xmlhttp.respons eText;
    }
    }
    xmlhttp.send(nu ll)
    }

    <form name="myForm" action="">
    <textarea name="outputSou rce" 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

    #2
    Re: HTTPRequest denied permission


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

    You must sign your script, see:

    The MDN Web Docs site provides information about Open Web technologies including HTML, CSS, and APIs for both Web sites and progressive web apps.



    JW



    Comment

    • Janwillem Borleffs

      #3
      Re: HTTPRequest denied permission


      "Janwillem Borleffs" <jw@jwscripts.c om> schreef in bericht
      news:3fea3e10$0 $196$1b62eedf@n ews.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



      Comment

      • Martin Honnen

        #4
        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("G ET", "blank.html " ,true);
        > xmlhttp.onready statechange=fun ction() {
        > if (xmlhttp.readyS tate==4) {
        > document.myForm .outputSource.v alue = xmlhttp.respons eText;
        > }
        > }
        > xmlhttp.send(nu ll)
        > }
        >
        > <form name="myForm" action="">
        > <textarea name="outputSou rce" 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.securi ty !=
        'undefined') {
        try {

        netscape.securi ty.PrivilegeMan ager.enablePriv ilege('Universa lBrowserRead');
        httpRequest.ope n('GET', 'http://javascript.faqt s.com/', true);
        httpRequest.onr eadystatechange = function (evt) {
        if (httpRequest.re adyState == 4) {
        alert(httpReque st.responseText );
        }
        };
        httpRequest.sen d(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


        Comment

        Working...