JavaScript Document Source URL (Definition)

JavaScript can be called directly instead of fetching a page.

JavaScript URLs can be used in the HREF attribute of an anchor tag. If this technique is used, a fragment of JavaScript code can call in an external function and generate the content of another page without ever calling a web server for the page.

Quite sophisticated dynamic page generation can be accomplished like this, however, at some stage you will have to have downloaded the JavaScript code to be executed in the first place.

Example code:

   var the_value = 100;
   function increment()
   <A HREF="javascript:alert(the_value)">Click to display the value</A>
   <A HREF="javascript:increment()">Click to increment the value</A>

See also:JavaScript Image Source URL, javascript: URL