W-Type WEB


WEB-Type Property.

  <prop name="MAP_WEB" visible="1" group="1" type="WEB" locked="true" width="100%" height="100%" labelwidth="0" fieldsize="1"  size="100" />



web-type Field

A type=“WEB” field is like an iframe of html. After specifying a width and a height, we load it of value by specifying a web address or by associating it an HTML code directly.

<prop name="MAP_WEBVIEW" type="WEB" enable-back-key="false" width="100%" height="85%" bgcolor="#FFFFFF" labelbox="false" labelwidth="0" />
 
      <create>
        <action name="runscript">
          <script language="VBScript">
        		this("MAP_WEBVIEW") = "http://www.elotrolado.net"
        		'tambien se le puede poner html directo (devuelto desde una funcion para poder poner los tags html fuera del xml)
        	</script>
        </action>
      </create>


We define a web-type node in the following way:

    <prop name="MAP_MI_TIPO_WEB" type="WEB" scales-to-fit="true" visible="1" width="96%" lmargin="2%" bgcolor="#FFFFFF" />



If we want that the web-type will be visualized in a correct way, when it has no data, we need to initialize it with the following value:

    self.MAP_MI_TIPO_WEB = “<html><head></head><body></body></html>”


Attributes
scales-to-fit It applies a viewport set to the webview width, but only in the case the HTML do not have one already defined. This attribute only is applied when loading the webview with an and it does not work for URLs.



Examples:

It launch a YouTube video, only having the value of the video on YouTube.

    function DevolverIframeVideoYoutube(sUrlYoutube,objeto){
      if(sUrlYoutube == ""){
            ui.showToast("Error, URL de youtube inválida");
            return "";
      }
      var longitud = sUrlYoutube.length;
      var urlIndice = sUrlYoutube.indexOf("watch?v=",1);
      if(urlIndice != -1){
            // Es una URL completa. Parseamos y sacamos el código.
            if(urlIndice >= longitud){
                // ui.ShowToast "Error, URL de youtube inválida”
                return "";
            }
            sUrlYoutube = sUrlYoutube.substring(urlIndice + 8, longitud);
            //Vemos si hay más parámetros después del código del vídeo,
            //para ignorarlos.
            var urlIndiceSiguenteParametro = sUrlYoutube.indexOf("&",1);
            if(urlIndiceSiguenteParametro > -1){
                  //No hay parámetros, cogemos desde aquí hasta el final nos vale.
            //}else{
                  //Hay parámetros. La posición del primer parámetro la hemos calculado
                  //a partir del InStr, así que se la sumamos para coger la posición
                  //en la cadena completa.
                  sUrlYoutube = sUrlYoutube.substring(1, urlIndiceSiguenteParametro - 1);
            }
   //objeto("MAP_IMG_FIJACAPITULO")="https://www.youtube.com/embed/" + sUrlYoutube + "?rel=0&autoplay=1"
      //objeto.MAP_IMG_FIJACAPITULO = sUrlYoutube;
	//Concatenamos el iframe.
      		return "<iframe id='video' type='text/html' width='100%' height='100%' src='https://www.youtube.com/embed/" + sUrlYoutube + "?rel=0&autoplay=0' 
      frameborder='0'/>";
	  }else{
	  		//objeto.MAP_IMG_FIJACAPITULO = sUrlYoutube;
	  		return "<iframe id='video' type='text/html' width='100%' height='100%' src='" + sUrlYoutube + "?rel=0&autoplay=0' frameborder='0'/>";
       }
   }