1 Reply Latest reply on Feb 6, 2009 7:48 AM by Dr. Fred Mbogo

    Javascript in adobe air question...

    scole954387
      I have a VERY simple javascript password script that just takes the password from a form and compares it... if password is correct is redirects to correct html file. I know the script is poorly written, but it does what I need for the time being.

      if (form.pass.value=="password") {
      window.location="page2.html"
      } else {
      alert("Invalid Password")
      }

      Although the script works, I can't seem to get it to redirect to the page2.html when the correct password is entered. If I replace the window.location with an alert it works so I know the rest of the code is working fine.

      Is there something I need to do in order to get window.location to work in an adobe air app? or is there an alternative that works? If there's an alternative, can you post example code?

      Thanks,
      Shannon
        • 1. Re: Javascript in adobe air question...
          Dr. Fred Mbogo
          I think you want window.location.href = "page2.html"

          When testing your code in a browser to see if it works, use WebKit or, if you're on a Mac, Safari. These use the same engine as AIR. Testing on IE only tells you that it's bug-compatible with IE, which isn't very helpful. You can also try Google Chrome, which uses the same HTML rendering engine as AIR, but not the same JS interpreter, so there can still be differences in behavior.

          I don't want to oversell this technique. AIR does have known differences with respect to the WebKit engine as used in standalone browsers, usually for security reasons. Still, if you find your code doesn't work in AIR, does work in IE or Firefox, but fails in WebKit or Safari, you know it's your code that's broken, not some limitation in AIR.