decorative banner

Using the JavaScript library


    You can choose the external JavaScript library feature on a per-page basis, as a site-wide setting, or as an application-wide preference. If you choose the option in the application preferences or site settings, all new pages and existing pages without preexisting JavaScript will use the new preference setting. Pages that already had actions and other JavaScript added to them will retain their existing JavaScript Functions setting. You must change the setting for these pages in the HTML tab of the Page Inspector.

To set the JavaScript library preference:

  1. Do one of the following:
    • To affect all new pages, set the application JavaScript library preference: Choose Edit > Preferences, and select Script Library in the left pane.
    • To affect all new pages in a site window, set the JavaScript library preference in the site settings: Click the Site Settings button Site Settings button in the toolbar, select Script Library in the left pane, and select Site Specific Settings in the right section.
    • To set the preference for a single page, open the HTML tab of the Page Inspector.
  2. Use the JavaScript options as follows:
    • Select Write Code Into Page to have GoLive write any required JavaScript code into the page(s).
    • Select Import GoLive Script Library to shift all shared JavaScript to an external JavaScript file. The file is saved to a folder named Generated Items by default.

    If you select the Import GoLive Script Library option, GoLive reacts in one of two ways, depending on whether or not you have a site document open:

    • If the site document is open, it will create a library file in a new folder named Generated Items at the root level of the site folder when you save the page.
    • If you don't have a site document open in the background when you save the page, GoLive writes the code to a default library file, which can be found in the Modules/JScripts/GlobalScripts subfolder of the GoLive application folder.

    Note: Selecting the Import GoLive Script Library option in the Preferences or Site Settings dialog boxes does not modify the Script Library settings for pages that contained preexisting JavaScript. To move code from those pages to the library, select Import GoLive Script Library in the HTML tab of the Page Inspector for each page.

  3. To rebuild the JavaScript library if it is damaged, click Rebuild in the application JavaScript preferences or in the Site Settings dialog box.
  4. Type a folder name for the JavaScript library and a library name with the suffix .js.