Skip to content

Example

FlorianDecker edited this page Sep 15, 2015 · 3 revisions

To configure DesktopGap a configuration file has to be provided, similar to this one:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="desktopGapConfiguration" type="DesktopGap.Configuration.DesktopGapConfiguration, DesktopGap.Core" />
  </configSections>
  
  <desktopGapConfiguration>
    <application 
      name="[TEST] Localhost App" 
      maxFrameNestingDepth="5" 
      baseUrl="http://localhost:3936"
      homeUrl="http://localhost:3936"
      alwaysOpenHomeUrl="true"
      allowCloseHomeTab="false"      
      alwaysShowUrl="true">
      <tabColors home="#CEECF5" application="#00FF00" nonApplication="#FF4000" />
    </application>    

    <security>
      <applicationUrls>
        <add domain="localhost" />
        <remove domain="localhost" path="/unsafe/content" />
      </applicationUrls>
      
      <startupUrls> 
        <add domain="localhost" path="/"  />
      </startupUrls>

      <allowedNonApplicationUrls>
        <add domain=".*" useRegex="true" /> 
        <remove domain="*.evil" />
      </allowedNonApplicationUrls>

      <addIns>			
        <add name="GuidService" />
      </addIns>
    </security>	

  </desktopGapConfiguration>
</configuration>

This file contains most of the necessary (but all of the required) configuration parameters.

Details

Here, the configuration is explained step-by-step, from top to bottom.

<configSections>

The head of the configuration is due to the use of C#'s Configuration classes, so this information does not have any effects on the configuration itself (except for probably invalidating it if changed)

<configuration>
  <configSections>
    <section name="desktopGapConfiguration" type="DesktopGap.Configuration.DesktopGapConfiguration, DesktopGap.Core" />
  </configSections>

<application>

The next part is the configuration itself: In the tag, information about the web application is stored:

The name of the web application (displayed in the title bar of DesktopGap):

name="[TEST] Localhost App"

The main URL, also to identify the web application. (requires a valid absolute URI path)

baseUrl="http://localhost:3936"

Optional Attributes

Also, the attributes show their default values here.

(optional) Frame nesting depth, i.e. how deep frame-nesting can go.

maxFrameNestingDepth="10"

(optional) The main page of the web application, which will be opened on start if enabled. (requires a valid absolute URI path)

homeUrl="http://localhost:3936"

(optional) Opens either the homeUrl if present or baseUrl

alwaysOpenHomeUrl="true"

optional [Link Missing] Make the home tab behave like any other tab (or not)

allowCloseHomeTab="false"

(optional) Show the URL bar below the tab bar also on application Urls (e.g. for debugging)

alwaysShowUrl="false"

(optional) The icon to show for the application. Should be a valid absolute URI path.

icon="http://localhost:3936/favicon.png"

<tabColors>

Color the tab headers according to their content.

(optional) Color for home tab.

home="#CEECF5"

(optional) Color for a tab containing an application URL.

application="#00FF00"

optional [Link Missing] Color for a tab containing an non-application URL.

nonApplication="#FF4000"

<security>

  • URLs belonging to the web application. Allow AddIn access.
  • URLs the application can be entered with (from external URLs and when starting). Subset of applicationUrls.
  • External URLs that should be allowed in DesktopGap. No AddIn access.

For all these, valid sub-elements are:

The domain part of a URL without the protocol. May start with a wildcard (*).

domain=""

Optional Attributes

(optional) The path part of a URL, without the query string. May end with a wildcard (*).

path=""

(optional) Use proper regular expressions in domain and path parts.

useRegex="false"

  • Allows certain AddIns to be loaded when using the application.

For all these, valid sub-elements are:

The name of a particular AddIn.

name=""

Clone this wiki locally