3 Replies Latest reply on Nov 14, 2008 11:19 PM by Dr. Fred Mbogo

    AIR apps developed using HTML+Javascript

    pravinpatil23
      Hi…

      I am working on Adobe AIR.

      And now I have 3 options to develop AIR applications 1)Flex 2) Flash 3) HTML+javascript.

      But can you please explain me when do I exactly use Flex Or HTML+JS Or Flash.

      One of the reason I know is Flex used for Rich UI applications

      Is there any list of requirements for which one of the 3 option is most suitable to use.


      And I have some more questions.

      1) Can AIR applications(developed using HTML+Js) invoke a web service running on a different server

      2) Can AIR application(developed using HTML+Js) detect the connectivity of USB drive (I have developed 1 application that can detect the Network connectivity and periodically reports the status I want the same in case of USB(plug & play) connectivity)

      3) I have one AIR application that has one HTML form on click of button I am posting the form Data to Java Servlet using “air.sendToURL()” as shown

      <script src="AIRAliases.js" />

      <script>

      function sendURL()
      {
      var url = " http://localhost:8080/InvokingServlet/Registration";

      var variables = new air.URLVariables();

      variables.username = document.f1.username.value;

      variables.password = document.f1.password.value;

      var request = new air.URLRequest(url);

      request.data = variables;

      air.sendToURL(request);

      alert("Data has been added to Remote DB...");

      }
      </script>

      The data goes to Servlet and then Servlet thru Jdbc Connectivity adds the data to database “MySQL” database named “user”

      If I read the data from database and print in Servlet it displays that to “tomcat server window(log)” But I want the data from Servlet to send back to HTML page where I can display it on the same HTML page where user entered his details. So even if I put the result into some Scope like session or request, but Can I read that it in HTML+Javascript page .

      -pravin.patil@bsil.com


        • 1. Re: AIR apps developed using HTML+Javascript
          Dr. Fred Mbogo Level 1
          quote:

          Originally posted by: pravinpatil23
          But can you please explain me when do I exactly use Flex Or HTML+JS Or Flash.
          This question gets asked about once a week. You can find my latest answer here and a little searching will dig up more opinions.

          quote:

          Can AIR applications(developed using HTML+Js) invoke a web service running on a different server

          An AIR application isn't hosted on a server, so all web servers are "foreign" to your AIR application. An AIR app does get downloaded from a server, most of the time, but it doesn't maintain some kind of special connection to that server.

          Because of this, there are no cross-domain restrictions in AIR like you have in a regular web browser.

          quote:

          Can AIR application(developed using HTML+Js) detect the connectivity of USB drive

          AIR does not allow low-level system access, and has very little in the way of platform-specific capabilities. So, you'd have to use a high-level, platform-agnostic way of checking for the drive, such as by looking around to see what files are available. Things like USB insert notifications are way outside the scope of AIR.

          quote:

          I want the data from Servlet to send back to HTML page where I can display it on the same HTML page where user entered his details.

          That question isn't on-topic here. Ask on a forum dealing with JSP servlets.
          • 2. AIR apps developed using HTML+Javascript
            Jp Cooper Level 1
            JKHGDKHGSLKJ -

            Now you have my curiosity_ You mention in your replies to pravinpatil23 that An AIR Application - which is in essence a wrapper that contains pretty much anything someone wants to build - HTML - Flash - JavaScript - PHP - etc... becomes foreign and no longer communicates with a server once it is on the desktop - then why aren't Server-based services able to be invoked ? That's a good deal what JavaScript does - I can create a JavaScript to populate an eMail Addressee field in a webpage or an eMail Client App_ I can have a script launch a Browser open a browser window and load any given URL_ If I build an HTML File with absolute Links - they'll open a website that they are pointing to_ I've tested this - so I know it works_

            So simply because I add an AIR package around a collection of webpages - why would this end up blocking out server communications? Or is that the limitation of AIR - once it's packaged it's a standalone - self-contained collection sealed off from the rest of the world? And if that is the case - then how do you explain the Adobe Media Player [AMP] ? When I've played with that I have never actually downloaded ALL of the content that it displays - yet I can access and interact with it as I want to? It has to be pulling that content from someplace - right?

            Probably an Internet hosted Server don't you think?

            This is just my opinion on the fly and I claim to be no expert by any means as I am slowly getting into developing content for AIR - but your comments seem rather definitive and they could use some elaboration_ I am really curious_
            • 3. Re: AIR apps developed using HTML+Javascript
              Dr. Fred Mbogo Level 1
              I think you misunderstood what I wrote. Because an AIR app isn't tied to a server, it has no restrictions on which servers it can contact. Compare a Flex or Flash application, which can only contact the server it came from, unless the author arranges to get a crossdomain.xml file placed on the other server. This is a security feature, to prevent an untrusted Flash applet from scraping data from servers behind a firewall and relaying it to the host site.

              Similar restrictions are being added to plain old web browsers to prevent similar cross-site scripting attacks in JS. Above and beyond what browser vendors are adding, you can tighten things down still further with addons like NoScript for Firefox, which these days does a lot more than disable JS.