1 Reply Latest reply on May 16, 2007 2:25 PM by Newsgroup_User

    SecurityErrorEvent only when hosted on webserver

    WinstonNg
      I wrote some simple code to load data from a URL. When executing on CS3 application on my workstation, fetching content from say "www.yahoo.com" works but when I deploy it to a web server on my workstation (same IP bindings) - it generates a SecurityErrorEvent as such:

      [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]

      Code snippet:
      var target = " http://www.yahoo.com";
      var req:URLRequest = new URLRequest(target);
      var loader:URLLoader = new URLLoader(req);

      loader.addEventListener(Event.COMPLETE, onComplete);
      loader.addEventListener(IOErrorEvent.IO_ERROR, onError);
      loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
      loader.load(req);

      Any ideas why this is happening?

      Thanks!
      Winston

        • 1. Re: SecurityErrorEvent only when hosted on webserver
          Level 7
          The host of the external file requires a crossdomain.xml policy file to
          allow you access. Since yahoo does not allow you access through its
          crossdomain.xml file ( http://www.yahoo.com/crossdomain.xml ) you cannot
          load text data from their domain from your own domain (or any other
          non-yahoo domain).

          This works in the authoring environment because the same security
          restrictions do not apply there.

          "WinstonNg" <webforumsuser@macromedia.com> wrote in message
          news:f2frmc$ngn$1@forums.macromedia.com...
          >I wrote some simple code to load data from a URL. When executing on CS3
          > application on my workstation, fetching content from say "www.yahoo.com"
          > works
          > but when I deploy it to a web server on my workstation (same IP
          > bindings) - it
          > generates a SecurityErrorEvent as such:
          >
          > [SecurityErrorEvent type="securityError" bubbles=false cancelable=false
          > eventPhase=2 text="Error #2048"]
          >
          > Code snippet:
          > var target = " http://www.yahoo.com";
          > var req:URLRequest = new URLRequest(target);
          > var loader:URLLoader = new URLLoader(req);
          >
          > loader.addEventListener(Event.COMPLETE, onComplete);
          > loader.addEventListener(IOErrorEvent.IO_ERROR, onError);
          > loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onError);
          > loader.load(req);
          >
          > Any ideas why this is happening?
          >
          > Thanks!
          > Winston
          >
          >
          >