3 Replies Latest reply on Mar 31, 2009 9:57 AM by Joe ... Ward

    setting global url

    scholarpack Level 1
      Suppose I develop an application which includes many html urls that is to be distributed and run from client's servers, each of which of course have a different domain. Is there a way in Air to set the top level url for each domain simply in one place and then all other urls use that in a relative way? I can't believe that this is not possible but I don't see any references in the docs.
        • 1. setting global url
          Joe ... Ward Level 4
          I'm not sure I quite follow the structure of your application. Are you distributing an AIR application that essentially loads a web application from one of many possible web servers? If that's the case, then it seems like the base URLs would be determined by the HTML code served by the web server, not the client AIR application.
          • 2. Re: setting global url
            scholarpack Level 1
            The application is a combination of of Air and html. There are many points at which html is called, not in one large application. This is fine if the app is distributed from one web server. However, if someone buys the app to distribute from their own servers do I have to re-write the server URLs throughout the whole app for each customer or is there a way to set it in one place for each customer. Or, is Air agnostic about where it is installed from?
            I hope this is more clear.
            • 3. Re: setting global url
              Joe ... Ward Level 4
              An AIR app won't know anything about the server you install it from (and it might not be installed from a server). There's no built-in API for setting a base URL -- and it wouldn't really make sense in the context of an AIR app since, in the general case, an AIR app is not tied to a particular server URL.

              You could create a variable in your app to use as the base for resolving URLs -- and the code to use it. Even if you use a base URL variable, you will have to set it somehow -- either post-install when the user configures the app, or by creating a separate AIR package for each client. One way to do this is to create an install badge for your clients that passes the server URL to the AIR app, which then saves the URL. (But also consider the case where the user downloads the AIR file and installs it later.)