Use HTML in Attributes
Overview
In this example we create some HTML code, which will open a URL in a new window, as a Layer’s attribute value.
Normally we would select the Link field in Studio and check the checkbox to generate a hyperlink for the field. Studio currently doesn’t support the creation of a hyperlink for a new tab/window directly but it does provide an opportunity to see how html can be stored in a layer’s field.
The following steps presume that you're using a table in PostgreSQL but this can work for other sources such as a Shape file or MapInfo tab file.
Open PgAdmin, and use the SQL dialogue to create a column in your table.
Populate the column with some HTML that includes the link with the target parameter.
Alter the SQL in the MapServer .map file to include theÂ
myhtml
 column asÂmyhtml_raw
 - this will ensure that the HTML is passed through without alteration.
LAYERÂ
 NAME "mylayer"Â
 STATUS OFFÂ
 TYPE POINTÂ
 INCLUDE "datashare.inc"Â
 DATA "wkb_geometry from (select *, myhtml as myhtml_raw from public.mytable) as foo using unique ogc_fid using srid=27700"Â
 TOLERANCE PIXELSÂ
 CLASSÂ
   NAME ""Â
   STYLEÂ
     SYMBOL "circle"Â
     SIZE 14Â
   ENDÂ
 ENDÂ
END |
In Studio includeÂ
myhtml_raw
 to in the list of columns displayed.Â
Make sure you include the http:// in the myhtml column - failing to so will result in the browser attempting to load the page as a local resource.
Â