agiles

Hyperlink from Map Feature

Discussion created by agiles on Jul 2, 2013
Latest reply on Oct 25, 2013 by agiles
Is there a way to bypass the infowindow and go directly to a hyperlink (via an attribute containing a web address) by clicking on a feature?

Or, to put it another way...

Right now my script is setup for an info window, but instead of pulling up the infowindow upon clicking a feature, I want to go straight to a webpage. How could I accomplish this?

EDIT 2013/07/03:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"
>

    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>
  
    </title>

    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css">
    <style>
      html, body, #mapDiv { height: 100%; margin: 0; padding: 0; }
    </style>

    <script>var dojoConfig = { parseOnLoad: true };</script>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/"></script>
    <script>



      dojo.require("esri.map");
      dojo.require("esri.layers.FeatureLayer");
      dojo.require("esri.dijit.InfoWindowLite");
 
      var map;

function init() {

     var infoWindowLite = new esri.dijit.InfoWindowLite(null, dojo.create("div"));

       map = new esri.Map("mapDiv", {
          basemap: "topo",
          center: [-95.650, 29.772],
          zoom: 11
});        
         
        var infoWindowLite = new esri.dijit.InfoWindowLite(null, dojo.create("div", null, map.root));
        infoWindowLite.startup();
        map.setInfoWindow(infoWindowLite);

        var template = new esri.InfoTemplate();
        template.setTitle("<b>${NAME}</b>");
        template.setContent("${WEB} ");
       
        var featureLayer = new esri.layers.FeatureLayer(".../MapServer/0", {
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          infoTemplate:template,
          outFields: ["WEB"]
        });

        map.addLayer(featureLayer);

        map.infoWindow.resize(200, 75);
      }

      dojo.ready(init);

    </script>
  </head>
 
  <body class="claro">
    <div id="mapDiv">
    
    </div>
  </body>

</html>

Outcomes