XPOR Javascript File object types

Linked Help

 

 

Overview 

Deploy custom javascript on your web pages - associate the Javascript object type to a web page Template and it will be available for all web pages made with that template.

The Javascript in these objects is compressed and cached natively by Xpor to reduce the size of file sent to the end user, and therefore reduce the load time of the page.

Using a Javascript File object avoids the more cumbersome method of including the javascript inside a bespoke code file on each page, each time you make a page.

Guidance

Overview

 

What is Javascript?

JavaScript is a programming language commonly used in web development. It was originally developed by Netscape as a means to add dynamic and interactive elements to websites. While JavaScript is influenced by Java, the syntax is more similar to C and is based on ECMAScript, a scripting language developed by Sun Microsystems.

JavaScript is a client-side scripting language, which means the source code is processed by the client's web browser rather than on the web server. This means JavaScript functions can run after a webpage has loaded without communicating with the server. For example, a JavaScript function may check a web form before it is submitted to make sure all the required fields have been filled out. The JavaScript code can produce an error message before any information is actually transmitted to the server.

Like server-side scripting languages, such as PHP and ASP, JavaScript code can be inserted anywhere within the HTML of a webpage. However, only the output of server-side code is displayed in the HTML, while JavaScript code remains fully visible in the source of the webpage. It can also be referenced in a separate .JS file, which may also be viewed in a browser.

What is a Javascrip File object?

A Javascript File is an object that contains solely Javascript code.

The user is presented with a context sensitive text editor within which they can enter and edit Javascript.

To use the file, the user would associate it to a website template which has pages for which the code is applicable.

Who would use one and why?

Generally this would be used by a developer or someone who considers themselves proficient with client-side code and who would like something to occur on several pages, that is not available within the system as standard.

For example:

  • Tag clouds
  • Animations
  • non-Google page tracking
  • etc

Why shouldn't I just include Javascript in a Bespoke Code File?

Javascript Files are built into a single cache file that is provided with a web page, when requested from the server.  Web pages are made from templates, which can be used to make any number of other web pages.  It is therefore likely to be significantly more efficient to associate the javcascript to the webpage, rather than to each web page.  Furtherore, the Javascript object can be assocaited to many webpage Templates.  This is a classic case of "make it once, use it many times" with the minimum of work.
The system automatically minifies (makes the file as small as possible) the Javascript to reduce the load time of the page.

 XPOR Ltd. UK Co. Registered in England No. 10409669
 02392 738000
 02392 739000