GSW Browser - Documentation



Getting Started
The two methods to use Cordova Plugins

If you do not have access to the web-application code (HTML / JavaScript), select JavaScript Injection.
If you do have access to the web-application code (HTML / JavaScript), select Build into Application.

Javascript Injection
Build into Application
Plugin Documentation
Below is a link to the GSW ConnectBot User Manual.
User Manual (PDF)

In each live demo, there will be a link to the Cordova documentation of that plugin.
Cordova Home Page
GSW Scanner API
GSW Unified Scanner API

The GSW Unified Scanner API makes it easy to utilize scanners from supported manufacturers.


GSW Scanner API

GSW Browser - JavaScript Injection

This documentation will show a basic example of how to use Cordova Plugins via JavaScript Injection



Overview


GSW ConnectBot supports DOM Injection, which allows to insert CSS and JavaScript into a loaded web page. This permits to add features, capabilities and change the look and feel of a part or all of any website at runtime without changing the original source code on the web server. Additionally, many websites are not designed to accommodate mobile device screens and require injection of device-specific CSS and JavaScript to properly format user interface elements and their layout.

The DOM Injection feature can be used, for example, to inject style sheets (CSS) or business logic (JavaScript code) into an SAP ITSmobile or other website for which it is not feasible to modify the source. To make sure that page modifications are applied only after the DOM is ready for them GSW ConnectBot DOM injection occurs after the page is completely loaded. GSW DOM Injection supports both CSS and JavaScript injection. At the time of this writing there is no GUI to support DOM Injection and manual editing of the host specific XML configuration file is required. Host specific XML configuration files are located in the 'webhostdir' folder in the LADS configs area, typically in this location:

 C:\Program Files (x86)\Georgia SoftWorks\Georgia SoftWorks Licensing and Deployment Server\files\configs\upload\configuration_name\webhostdir


CSS injection uses XML element named 'css-injection' and JavaScript injection uses 'js-injection'. The rest of the XML syntax is the same for both 'css-injection' and 'js-injection’.



Attributes

1.1 File

File to be injected located in the respective webhostdir



1.2 Pages

You can restrict the urls where GSW ConnectBot performs injection based on the url value. This field allows you to specify a semicolon-separated list of url patterns where you want the injection to occur. If url being loaded matches any of the patterns then injection will be performed. The type of match being performed depends on the value of pages_uses_regex. If the latter is false then the pattern must be either the star character to match all pages or an exact url of a specific page. If pages_uses_regex is true then the GSW ConnectBot will perform a regular expression match.



1.3 pages_uses_regex

Specifies the type of match for the pages field as detailed in section 1.2.



1.4 Conditions

You can further restrict the urls where GSW ConnectBot performs injection based on the content of the page being loaded. This field allows you to specify list of url content patterns where you want the injection to occur. The list is separated by the value specified in the conditions_separator. If conditions is not empty then the url being loaded must match all of the conditions specified in this field. The type of match being performed depends on the value of conditions_uses_selector. If the latter is false then the specified pattern must match a piece of text somewhere on the page. If conditions_uses_selector is set to true then the match is performed using jsoup CSS selector syntax as specified in here.



1.5 conditions_uses_selector

Specifies the type of match for the conditions field as detalied in the section 1.4



1.6 conditions_seperator

Specifies the separator for the conditions field as detailed in the section 1.4.




Example 1

This example will inject "mystyle.css" into every page


 <css-injection conditions_uses_selector="true" conditions_separator="|" conditions="" file="mystyle.css" pages="*" pages_uses_regex="false" />
          



Example 2

This example will inject "myscript.js" into pages: http://www.gardenoaks.com/live.php & http://www.gardenoaks.com/live-oak-culture.php


<js-injection conditions_uses_selector="false" conditions_separator="|" conditions="" file="myscript.js" pages="http://www.gardenoaks.com/live.php; http://www.gardenoaks.com/live-oak-culture.php" pages_uses_regex="false"/>" />
          



Example 3

This example will inject "mystyle.css" into the homepage of greenfieldsandvalleys.com


<css-injection conditions_uses_selector="false" conditions_separator="|" conditions="" file=" greenstyle.css" pages=" https?:\/\/(www\.)?greenfieldsandvalleys\.com\/?" pages_uses_regex="true"/>
          


Build Into Existing or New Application

This documentation will give examples showing how to use Cordova Plugins via building it into the application.


Using this method will be the easiest / most straight-forward. Note: You must have access to the HTML / JavaScript of your web-application.

Getting Started

1.

First, locate the HTML or PHP files that create the pages of your web-application that will have added functionality via Cordova Plugins.

2.

Second, insert a link to a JavaScript file (we will create the file in the next step). Ideally, this should be at the end of the body tags.

 
<script src="gswscripts.js"/></script>
         

3.

Third, create a JavaScript file with the name listed. In this example, it would be called gswscripts.js

4.

Fourth, locate the plugin you would like to use and copy the code into this JavaScript file. We reccomened copying the JavaScript from the code section as a starting point. Be aware the the live demo code does refer to HTML button IDs, so for functionality to be exactly the same as in the demos, you will need to create HTML elements with corresponding IDs.

5.

Next, customize the plugin to get the exact functionality desired. Plugins can be ran in the background (geolocation, battery info, network information, etc.) and then sent to a server to be processed for analytics and metrics.


About

Using the provided demonstrations as a starting point is highly reccomended. The JavaScript code is written with proper name-spacing to ensure there are no function naming conflicts with your current application.