Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Javascript Proxy communication

Javascript Proxy communication

Scheduled Pinned Locked Moved Web Development
javascriptsysadmintoolsquestion
11 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #1

    I'm trying to write a simple javascript script that will enable the web page to send commands to my proxy server that I'm developing. However it appears that both Firefox and IE block any attempt to use the XMLHttpRequest object to send web requests. Is there ANY way I can get javascript to send ANY kind of information over the wire that my proxy server can intercept and provide custom services?

    -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

    B 1 Reply Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I'm trying to write a simple javascript script that will enable the web page to send commands to my proxy server that I'm developing. However it appears that both Firefox and IE block any attempt to use the XMLHttpRequest object to send web requests. Is there ANY way I can get javascript to send ANY kind of information over the wire that my proxy server can intercept and provide custom services?

      -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

      B Offline
      B Offline
      Bradml
      wrote on last edited by
      #2

      I don't completely understand, are you saying that IE and Firefox aren't letting you make Ajax calls? The XMLHttpRequest does send web requests. In addition what sort of proxy are you using?


      Brad Australian By contacting your lawyer you negate the right to sue me.

      Richard Andrew x64R 1 Reply Last reply
      0
      • B Bradml

        I don't completely understand, are you saying that IE and Firefox aren't letting you make Ajax calls? The XMLHttpRequest does send web requests. In addition what sort of proxy are you using?


        Brad Australian By contacting your lawyer you negate the right to sue me.

        Richard Andrew x64R Offline
        Richard Andrew x64R Offline
        Richard Andrew x64
        wrote on last edited by
        #3

        Hi Brad, I wrote a simple script that calls open( "GET", url, true ); and the Error Console in Firefox says, "Permission denied to call method XMHttpRequest.open" The proxy is something I'm developing. It's going to be an intercepting proxy. In the code below, the alert( "Request sent" )never gets called:

        var xmlhttp;

        function loadPage( url )
        {
        xmlhttp=new XMLHttpRequest();
        xmlhttp.onreadystatechange=state_Change;
        xmlhttp.open("GET",url,true);
        xmlhttp.send(null);
        alert( "Request Sent" );
        }

        function state_Change()
        {
        // if xmlhttp shows "loaded"
        alert("State Change" );
        if (xmlhttp.readyState==4)
        {
        // if "OK"
        if (xmlhttp.status==200)
        {
        // ...some code here...
        alert( "200 OK!" );
        }
        else
        {
        alert("Problem retrieving XML data");
        }
        }
        }

        -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

        B 1 Reply Last reply
        0
        • Richard Andrew x64R Richard Andrew x64

          Hi Brad, I wrote a simple script that calls open( "GET", url, true ); and the Error Console in Firefox says, "Permission denied to call method XMHttpRequest.open" The proxy is something I'm developing. It's going to be an intercepting proxy. In the code below, the alert( "Request sent" )never gets called:

          var xmlhttp;

          function loadPage( url )
          {
          xmlhttp=new XMLHttpRequest();
          xmlhttp.onreadystatechange=state_Change;
          xmlhttp.open("GET",url,true);
          xmlhttp.send(null);
          alert( "Request Sent" );
          }

          function state_Change()
          {
          // if xmlhttp shows "loaded"
          alert("State Change" );
          if (xmlhttp.readyState==4)
          {
          // if "OK"
          if (xmlhttp.status==200)
          {
          // ...some code here...
          alert( "200 OK!" );
          }
          else
          {
          alert("Problem retrieving XML data");
          }
          }
          }

          -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

          B Offline
          B Offline
          Bradml
          wrote on last edited by
          #4

          Can you post all the javascript that relates to the request here?


          Brad Australian By contacting your lawyer you negate the right to sue me.

          Richard Andrew x64R 1 Reply Last reply
          0
          • B Bradml

            Can you post all the javascript that relates to the request here?


            Brad Australian By contacting your lawyer you negate the right to sue me.

            Richard Andrew x64R Offline
            Richard Andrew x64R Offline
            Richard Andrew x64
            wrote on last edited by
            #5

            I'm just beginning to learn javascript, so the code I'm trying to use is very simple: ( Thanks for your help ) It says "window.removed" below, but that's something CodeProject did. The real code says "onload"

            <!--
            function myonload( )
            {
            loadDoc( "http://www.google.com" );

            }

            window.onload = myonload;
            var xmlhttp;

            function state_Change()
            {
            // if xmlhttp shows "loaded"
            alert("State Change" );
            if (xmlhttp.readyState==4)
            {
            // if "OK"
            if (xmlhttp.status==200)
            {
            // ...some code here...
            alert( "200 OK!" );
            }
            else
            {
            alert("Problem retrieving XML data");
            }
            }
            }

            function loadDoc( url )
            {
            xmlhttp=new XMLHttpRequest();
            xmlhttp.removed=state_Change;
            xmlhttp.open("GET",url,true);
            xmlhttp.send(null);
            alert( "Request Sent" );
            }

            //-->

            -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

            B 1 Reply Last reply
            0
            • Richard Andrew x64R Richard Andrew x64

              I'm just beginning to learn javascript, so the code I'm trying to use is very simple: ( Thanks for your help ) It says "window.removed" below, but that's something CodeProject did. The real code says "onload"

              <!--
              function myonload( )
              {
              loadDoc( "http://www.google.com" );

              }

              window.onload = myonload;
              var xmlhttp;

              function state_Change()
              {
              // if xmlhttp shows "loaded"
              alert("State Change" );
              if (xmlhttp.readyState==4)
              {
              // if "OK"
              if (xmlhttp.status==200)
              {
              // ...some code here...
              alert( "200 OK!" );
              }
              else
              {
              alert("Problem retrieving XML data");
              }
              }
              }

              function loadDoc( url )
              {
              xmlhttp=new XMLHttpRequest();
              xmlhttp.removed=state_Change;
              xmlhttp.open("GET",url,true);
              xmlhttp.send(null);
              alert( "Request Sent" );
              }

              //-->

              -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

              B Offline
              B Offline
              Bradml
              wrote on last edited by
              #6

              My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.


              Brad Australian By contacting your lawyer you negate the right to sue me.

              Richard Andrew x64R 2 Replies Last reply
              0
              • B Bradml

                My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.


                Brad Australian By contacting your lawyer you negate the right to sue me.

                Richard Andrew x64R Offline
                Richard Andrew x64R Offline
                Richard Andrew x64
                wrote on last edited by
                #7

                That's OK, thanks for your participation anyway. I will take a look at that link and see if it can provide some clues. :)

                -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                1 Reply Last reply
                0
                • B Bradml

                  My suggestion is to revise the Mozilla tutorial on Ajax. http://developer.mozilla.org/en/docs/AJAX:Getting_Started[^] I am sorry I could not have been of more help, but I can't really see an error with the script.


                  Brad Australian By contacting your lawyer you negate the right to sue me.

                  Richard Andrew x64R Offline
                  Richard Andrew x64R Offline
                  Richard Andrew x64
                  wrote on last edited by
                  #8

                  Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!

                  -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                  B R S 3 Replies Last reply
                  0
                  • Richard Andrew x64R Richard Andrew x64

                    Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!

                    -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                    B Offline
                    B Offline
                    Bradml
                    wrote on last edited by
                    #9

                    That must be new to FF. No problem btw. Thanks for asking the question, I could have seen myself making the same mistake. BTW a quick hack to get past this is to build PHP/ASP application that will call the requested page, and have that uploaded to ur server.


                    Brad Australian By contacting your lawyer you negate the right to sue me.

                    1 Reply Last reply
                    0
                    • Richard Andrew x64R Richard Andrew x64

                      Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!

                      -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                      R Offline
                      R Offline
                      RichardGrimmer
                      wrote on last edited by
                      #10

                      Richie308 wrote:

                      It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.

                      Much as it pains me to admit it, apparently ATLAS provides a way around this.

                      "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

                      1 Reply Last reply
                      0
                      • Richard Andrew x64R Richard Andrew x64

                        Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to. So because I was requesting Google, it gave the permission denied error. Thanks!

                        -------------------------------- "All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke

                        S Offline
                        S Offline
                        Shog9 0
                        wrote on last edited by
                        #11

                        Richie308 wrote:

                        It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.

                        It would be a huge security hole otherwise. There are ways of getting around this for most browsers, but they require the user to explicitly allow the exception - so, they're more useful for intranet-type development.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups