mcs:script

Purpose

Refers to an external script or to a script policy, or contains a script.

Contained by

Attributes

Attribute Description Type Default Options Use
id Unique identifier for the element xs:ID     optional 
src Name of the script policy or the location of an external script file xs:anyURI     optional 
srctype Content type of an external script file or a script policy referenced by the src attribute xs:string   'text/javascript' for an external script; 'application/vnd.volantis.mcs-script' for a script policy   optional 
type Content type of the element's content xs:string     optional 

Examples

Inline script:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>mcs:script</title>
    <mcs:script type="text/javascript">alert('hello')</mcs:script>
  </head>
  <body>
    <p>Welcome</p>
  </body>
</html>

Script policy:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>mcs:script</title>
    <mcs:script src="/script.mscr" srctype="application/vnd.volantis.mcs-script"/>
  </head>
  <body>
    <p>Welcome</p>
  </body>
</html>

External JS file:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:mcs="http://www.volantis.com/xmlns/2006/01/xdime/mcs">
  <head>
    <title>mcs:script</title>
    <mcs:script src="../script.js" srctype="text/javascript"/>
  </head>
  <body>
    <p>Welcome</p>
  </body>
</html>

Where, the script.mscr script policy and the external script script.js contain the following JS:

alert('hello')

Related topics