How to add a script to the application |
To add a user-defined script that you want to be available from any point in your application:
js/MyScripts.js
Alternatively, you can skip Steps 2-5 and use the default js/CustScript.js (for JavaScript code) or css/CustStyle.css (for CSS code) files. These are included in the publication by default because they are referred by the HTML header of the "application.html" initial document. First make a copy of the file in the appropriate "js" or "css" subfolder of the Alternative Template Folder. Then add your user-defined code to that copy. When finished, save and (re-)publish.
If you prefer, you can also declare application-level scripts by adding an extra <script> tag in the HTML header of the initial document: 1. Copy the "application.html" file from your Publication Directory to the "WebSite" subfolder of the Alternative Template Folder. 2. In the copy, add a <script> tag identifying the location of the user-defined script(s). 3. (Re-)publish. Adding a <script> tag in the HTML is perhaps more maintainable if, for some reason, you use different start pages for different publications based on the same repository. It does, however, have a drawback. It could require work at a future time when you upgrade to a different USoft version, since any changes that USoft might make to "application.html" will not automatically come through. |