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:
Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.
This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.
This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.
The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important