developer_guide:voicexml_references:elements:script

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


developer_guide:voicexml_references:elements:script [2015/10/27 21:44] (current) – created borja
Line 1: Line 1:
 +====== < script > ======
  
 +===== Description =====
 +
 +The <script> element includes a block of client-side script.  Each <script> element is executed in the scope of its containing element; i.e., it does not have its own scope.  Variables defined in the <script> element are equivalent to variables defined using <var> within the same scope.
 +
 +===== Syntax =====
 +
 +<code>
 +<script
 +src="URI"
 +charset="Encoding"
 +fetchhint="prefetch" | "safe"
 +fetchtimeout="time_interval"
 +maxage="time_interval"
 +maxstale="time_interval">
 +Script Text
 +</script>
 +</code>
 +
 +===== Attributes =====
 +
 +|src|The src attribute is the URI specifying the location of the external script. This attribute is optional.|
 +|charset|The charset attribute is character encoding if external script is used. This attribute is optional.|
 +|fetchtimeout|The fetchtimeout attribute is the time interval to wait for audio file to be fetched before playing the alternate content. This attribute is optional.|
 +|fetchhint|The fetchhint defines when the audio file should be retrieved. This attribute is optional. \\ * prefetch – the audio file may be downloaded when the page is loaded. \\ * safe – the audio file loads only when needed.|
 +|maxage|The maxage attribute indicates the maximum time in seconds that this document will use this script file before fetching another copy. This attribute is optional.|
 +|maxstale|The maxstale attribute indicates the maximum time in seconds that this document will use a script file that has exceeded the maxage time. This attribute is optional.|
 +
 +===== Parents =====
 +
 +<code>
 +<block>, <catch>, <error>, <filled>, <form>, <help>, <if>, <menu>, <noinput>, <nomatch>, <vxml>
 +</code>
 +
 +===== Children =====
 +
 +<code>
 +None.
 +</code>
 +
 +===== Extensions =====
 +
 +<code>
 +None.
 +</code>
 +
 +===== Limitations/Restrictions =====
 +
 +<code>
 +None.
 +</code>
 +
 +===== Example Code =====
 +
 +<code>
 +<?xml version="1.0"?>
 +<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
 + <script>
 + <![CDATA[
 +   function alwaysTrue() {
 +   // no need to escape the following less than sign
 +   return 1 < 2;
 +   }
 + ]]>
 + </script>
 + <block>
 +  <prompt>
 +   Hello
 +  </prompt>
 +  <prompt cond="alwaysTrue">
 +   I am always here
 +  </prompt>
 + </block>
 +</vxml>
 +</code>
 +
 +NOTE:
 +
 +It is wise to put CDATA escapes around your scripts so you don't have to escape XML reserved characters (eg. <, >, &, etc).
  • developer_guide/voicexml_references/elements/script.txt
  • Last modified: 2015/10/27 21:44
  • by borja