IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
You use the 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.
After you place the JavaScript widget on your page, you configure which JavaScript to include.
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.
To do this, click Edit button in the upper-right corner of the widget. The following sections describe the configuration options in the JavaScript window.
You can either write your own JavaScript or simply link to an existing JavaScript file. Do one of the following:
var str = "Hello World!";
NOTE: You do not need to add <script> tag, since it is automatically added.
<script>
.JS
In Where to include in HTML? section, select one of the following:
To optionally add a description for the JavaScript file, expand the More options section. The description is displayed only when pages are in edit mode, so that you can distinguish JavaScript files easily.
You define model settings in the Advanced settings section. Model settings display all properties directly bound to the JavaScript widget model. Access these properties by clicking the Model button in Advanced settings.
Description Gets and sets the description of the JavaScript that is referenced. This field is for your convenience only.
FileUrl Gets and sets resource URL which will be referenced. This FileUrl is used only when the widget is in Link to JavaScript file mode.
InlineCode Gets and sets the inline code that is displayed in the code area while widget is in Write JavaScript mode.
Mode Defines the supported ways to refer JavaScript through the widget. There are two possible options:
Position Gets and sets the position in the document where the code will be inserted. The possible values are:
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important