4 Replies Latest reply on Jan 22, 2008 3:02 PM by Peter deHaan

    navigateToURL problems

    Mike8086
      Our flex 3 app is called from Coldfusion/HTML, and when the app finishes, we need it to refresh the page the app is on to update images. Unfortunately, it seems there is a bug in navigateToURL that makes it ineffective in Firefox.

      We tried a workaround where we try to call JavaScript to get it to refresh the page, but that doesn't work either, on the production server.

      The strange thing is, it works fine from my local developer's environment. I run the app, then when it finishes, as in the example below, the browser hits google's homepage just fine.

      But when we put the app on the production server, it is not running the JS refresh. It doesn't report any security or other errors, either. It just "sits" there.

      Our production environment looks like this:
      Server 1: SWF file
      Server 2: HTML that calls SWF file, embedded in Coldfusion CFM file.

      We have "allowScriptAccess" set to "always" in the html file.

      Also, we set up cross-domain access that is allowing the actual SWF file to run across servers without generating security errors. It runs fine and performs its task to upload a file to the server. But at the end, the refresh/call to HTML from Flex/JS doesn't work.

      Here's a couple of code snippets:

      --- JAVASCRIPT ---
      function moveit() {
      window.location = ' http://www.google.com'
      }

      --- FLEX ---
      package {
      import flash.external.ExternalInterface;
      public class URLUtil
      {
      protected static const WINDOW_OPEN_FUNCTION : String = "moveit()";
      public static function openWindow(url : String, window : String = "_blank",
      features : String = "") : void
      {
      ExternalInterface.call(WINDOW_OPEN_FUNCTION);
      //ExternalInterface.call(WINDOW_OPEN_FUNCTION, url, window, features);
      }
      }
      }

      and the actionscript that calls it:

      URLUtil.openWindow(" http://www.google.com/");

      We are just trying to get ANY type of refresh/call to HTML working at this point. Any help would be appreciated!

      Thanks!
      Mike
        • 1. Re: navigateToURL problems
          Michael_Latta
          Have you tried redirecting to a local url that redirects out? Have the flex redirect to a page on server 2 that in turn redirects to google. Then you can determine if the issue is with cross-domain issues, security, or something else.
          • 2. Re: navigateToURL problems
            Peter deHaan Level 4
            Mike8086,

            I tested a simple application in Flex 3/HTML but wasn't able to reproduce the problem when opening the HTML file from Flex Builder or from my local server via http://.

            Here's my JavaScript function in my HTML template:

            <script language="javascript">
            function moveIt(label, url) {
            alert(label);
            window.location = url;
            }
            </script>

            And here's my Flex app:

            Peter
            • 3. Re: navigateToURL problems
              Michael_Latta Level 1
              Another thing to try is to use your machine name rather than localhost when working on your development machine. That may reproduce the problem that is happening in your servers. You could even mix the IP address, machine name and such to produce different domains as in production.
              • 4. Re: navigateToURL problems
                Peter deHaan Level 4
                Also, if it is working on one machine and not another, check for JavaScript errors on the production server. And maybe confirm that the object/embed code being used is the same on both machines. Perhaps one is setting allowScriptAccess and the other isnt.

                Peter