3 Replies Latest reply on May 6, 2008 8:35 PM by symfony

    working with no application sandbox

    symfony
      Hi,

      I have an online website with some features.

      I need to develop air based desktop application by accessing some features of my online application.
      I wenth through the available tutorials and came across non application sandbox feature.

      I installed Air SDK.
      I created a directory structure as follows

      airdesktop
      css
      js
      remote
      images
      application.xml
      home.html

      The css folder contains styles and images contains images and js folder contains js files.
      The remote folder contains
      one.html,2.html,3.html

      Home.html contains iframe

      <html>
      <head>
      <titleDesktop</title>
      <link href="css/styles.css" type="text/css" rel="stylesheet" />
      <script src="js/AIRAliases.js" type="text/javascript"></script>
      <script src="js/AIRIntrospector.js" type="text/javascript"></script>
      <script src="js/AIRSourceViewer.js" type="text/javascript" ></script>
      <script src="js/prototype.js" type="text/javascript" ></script>
      <script type="text/javascript">
      var bridgeInterface = {};
      bridgeInterface.testProperty = "Bridge engaged";
      bridgeInterface.isLoggedIn = false;
      function setupBridge(){
      document.getElementById("sandbox").contentWindow.parentSandboxBridge=bridgeInterface;
      }
      bridgeInterface.navigate=function(){
      var url = "app:/remote/one.html";
      }
      </script>
      </head>
      <body>
      <iframe id="sandbox"
      src="one.html"
      documentRoot="app:/remote"
      sandboxRoot=" http://xyz.com"
      ondominitialize="setupBridge()" width="100%" height="100%" allowCrossDomaininXHR="true">
      </iframe>
      </body>
      </html>


      So home.html contains iframe whose src is one.html.

      one.html contains login related files. And in the onLoad of one.html i have to check whether user is logged in by checking parentSandbox variable isLoggedIn if loggedin i have to redirect to two.html if not display login screen(one.html).

      If one.html displayed and user enters email id and password i have to submit to my online application which is in PHP and validate the user and get the return if success then set isLoggedIn to true and redirect to two.html.

      two.html contains link to three.html and three.html contains link to say 4.html basically all are different forms when submitted i have to submit through ajax and get the result.

      I have some confusion here.

      Instead of using one.html, two.html,three.html,... can i directly access my online application pages using the iframe if yes how to my online application is in php.

      If i use the above said directory structure how to implement the functionality like if user is logged in how to redirect
      i can use window.document.location.href='....' but what is the url for the is it of type app:/.... or else

      Did anybody worked on this kinda application please guide me through this.

      your help will be greatly appreciated

      Thanks
        • 1. Re: working with no application sandbox
          Joe ... Ward Level 4
          quote:

          Instead of using one.html, two.html,three.html,... can i directly access my online application pages using the iframe if yes how to my online application is in php.


          You can directly access the online application -- if the user is online, of course. The pages are sent by the server as HTML (you couldn't, of course, load the php source into the iFrame). One issue with your setup for this is that by setting the sandboxRoot attribute to the root of your website, you can't actually access the website. Instead of sandboxRoot=" http://xyz.com" use sandboxRoot=" http://xyz.com/air/" (or some other dummy folder name). Otherwise AIR will look for all URLs from xyz.com in your application's "remote" directory.

          quote:

          If i use the above said directory structure how to implement the functionality like if user is logged in how to redirect
          i can use window.document.location.href='....' but what is the url for the is it of type app:/.... or else


          Use " http://xyz.com/air/2.html" (assuming you added air to the sandboxRoot path). The part of the url matching the sandboxRoot attribute is replaced with the string in the documentRoot attribute.
          • 2. Re: working with no application sandbox
            symfony Level 1
            Hi,

            Thanks for the reply.

            I will be very much thankful to you if i could get some example code representing the said scenario because i could not get this working.


            Thanks


            • 3. Re: working with no application sandbox
              symfony Level 1
              HI Joe,


              thanks for the suggestion. with u r help i could make my air application to work with my online php appl


              <iframe id="sandbox"
              src=" http://xyz.com/abcd/index"
              documentRoot=" http://xyz.com/abcd/index"
              sandboxRoot=" http://xyz.com/abcd"
              ondominitialize="setupBridge()" width="98%" height="450" allowCrossDomaininXHR="true">
              </iframe>

              Thanks
              Prasad