External JavaScript (global)



External JavaScript files and external JavaScript frameworks like jQuery can be added to your Profound UI installation so that they are loaded globally and are available for usage on all screens within your applications. 

For Rich Display File Applications

The JavaScript files must be saved to an IFS file that is located in the following directory, or any sub-directories below it.

/www/{instance_name}/htdocs/profoundui/userdata/custom

(Where '{instance_name}' is the name of your installed instance of Profound UI.)



For Rich Display file applications, all of the files under the 'userdata/custom' directory will be automatically loaded into your applications.



Example:

If the below code was saved to the following file file in the IFS: /www/profoundui/htdocs/profoundui/userdata/custom/js/validateEmail.js

function isValidEmail(email) { var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; return emailPattern.test(email); }

Then the isValidEmail() function defined here can be used in any Rich Display File application running under the Profound UI instance named 'profoundui'.



For Mobile Sessions

When accessing Rich Display applications via a mobile app such as the Profound UI Mobile Client, please note that files in userdata/custom are not loaded like they are when accessing the same applications from a web browser. To globally load JavaScript and CSS files in a mobile session, place them into the following IFS directory or any sub-directory below it (see here for more information): 1

/www/{instance_name}/htdocs/profoundui/userdata/extension/mobile

(Where '{instance_name}' is the name of your installed instance of Profound UI.)



For Rich Display applications, all of the files under the 'userdata/extension/mobile' directory will be automatically loaded into your applications when accessed from a mobile PhoneGap-style app. 



For Genie Sessions

The JavaScript file should first be saved to a file on the IFS under the htdocs directory in your instance of Profound UI.  It is recommended to save the file in a sub-directory under the userdata directory, similar to how it is recommended for Rich Display File Applications above.  But, be aware if you save the file in the 'custom' sub-directory, the JavaScript code will also be automatically loaded into all of your Rich Display Applications as well.  If a sub-directory named 'js' does not already exist in the userdata directory, you can create it and save the JavaScript file within it.

Next you will need to add the following line of code to the start.html file of every Genie skin you want this external JavaScript to be available in.

Each file you wish to add to your Genie Sessions must be individually included this way. This script tag should be located after the script tag for the genie.js file but before the script tag for the skin's custom.js file.



Example:

To enable the jQuery JavaScript framework in the Genie Skin called Hybrid, first save the JavaScript file to the IFS (in this example the file is called jquery.js and is saved in the 'userdata/js' directory). Then, in the Genie Administrator, modify the start.html file of the Hybrid skin to the following:

Now the jQuery framework is available in all Genie Sessions using the Hybrid skin.




1 This feature is available in Profound UI Version 6, Fix Pack 4.0 and above.