Views

MyMobileWeb Script Tag

From Morfeo Wiki

Jump to: navigation, search

Overview

The Script control allows the user to import js files to MyMobileWeb applications. Note that this feature is only available for delivery contexts supports script (view scriptSupport - DDR Core Vocabulary). Script tag is child of head tag.

Attributes

The attributes supported by this tag are the following:

  • Attribute: id
    Identifier for this control.
  • Attribute: expr
    E.L. which contains the condition to render the control or not. Important not contains ${}
    Default value: true.
  • Attribute: src (required)
    This attribute specifies the location of an external source for the contents of the element. It can be an E.L.
  • Attribute: type (required)
    This attribute gives an advisory hint as to the content type of the content available at the link target address. It can be an E.L.
  • Attribute: charset
    This attribute specifies the character encoding of the resource designated by the control.
  • Attribute: defer
    User agent may defer execution of script.

Example

The following examples using Script component.

   <mymw:head>
      <mymw:title>My example</mymw:title>
      <mymw:script expr="sessionScope._MYMW_LANG == 'es_ES'" type="text/javascript" src="script/example_es_ES.js"/>
      <mymw:script expr="sessionScope._MYMW_LANG == 'en_US'" type="text/javascript" src="script/example_en_US.js"/>
   </mymw:head>
   <mymw:head>
      <mymw:title>My example</mymw:title>
      <mymw:script expr="deliveryContext.scriptSupport['ecmascript-MP']" type="text/javascript" src="script/example.js"/>
   </mymw:head>
   <mymw:head>
      <mymw:title>My example</mymw:title>
      <mymw:script charset="UTF-8" type="${scriptType}" src="${scriptFile}"/>
   </mymw:head>