JavaScript widget

Use JavaScript widget to embed JavaScript code in your page. JavaScript is used to enhance the functionality of your website. For example, you can use JavaScript to validate user input.

To add a JavaScript code to your page, perform the following:

  1. Drag the JavaScript widget on the page and click Edit button in the upper-right corner of the widget.
    The JavaScript window appears.

    NOTE: If you add JavaScript widget in a page template the JavaScript is applied to all the pages that use this template. If you add it on one particular page, the JavaScript is applied only to this page.

  2. Add the JavaScript code in one of the following ways:
    • If the JavaScript file (files with .js extension) you want to apply is already uploaded, on Link to a JavaScript file (.js) tab, in URL input field, enter the URL of an already uploaded JavaScript file.
      Click Select…button, browse the uploaded files to select the JavaScript file you want to apply, and click Done.
    • If you want to add custom JavaScript code, on Write JavaScript tab, enter the JavaScript code in the input field.
  3. In Where to include in HTML? radio button, select one of the following.
    Select one of the following:
    • In the head tag
      The JavaScript is executed immediately when a page starts to load.
    • Where the widget is dropped
      The JavaScript is executed when the widget is being loaded.
    • Before the closing body tag
      The JavaScript is executed at the end of the page’s loading process.
      For example, this option is often used to embed page tracking code, such as Google Analytics, because if this code is executed, it means that the user has not closed the page before the page has been fully loaded.
  4. When you are finished, click Save.
    The JavaScript window closes and the system embeds the link to the JavaScript file or the code you have written where you have specified in Where to include in HTML radio button.

Additional resources

ARTICLES

Was this article helpful?