1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <title>OpenLayers Example</title>
4 <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
5 <link rel="stylesheet" href="style.css" type="text/css" />
6 <script src="../lib/OpenLayers.js"></script>
7 <script type="text/javascript">
8 // making this a global variable so that it is accessible for
9 // debugging/inspecting in Firebug
14 //set title name to include Browser Detection
15 // this is the only way to test the functionality
16 // of the getBrowserName() function
18 var header = OpenLayers.Util.getElement("browserHeader");
19 header.innerHTML = "(browser: ";
20 var browserCode = OpenLayers.Util.getBrowserName();
21 switch (browserCode) {
23 browserName = "Opera";
26 browserName = "Internet Explorer";
29 browserName = "Safari";
32 browserName = "FireFox";
35 browserName = "Mozilla";
38 browserName = "detection error"
41 header.innerHTML += browserName + ")";
43 map = new OpenLayers.Map('map');
46 resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
49 var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
50 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'},
54 resolutions: [0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
56 var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
57 "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
58 {layers: "landsat7"}, options2);
60 var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
61 "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
62 {layers: "bathymetry,land_fn,park,drain_fn,drainage," +
63 "prov_bound,fedlimit,rail,road,popplace",
64 transparent: "true", format: "image/png"},
65 {minResolution: 0.17578125,
66 maxResolution: 0.703125});
68 map.addLayers([ol_wms, jpl_wms, dm_wms]);
69 map.addControl(new OpenLayers.Control.LayerSwitcher());
70 // map.setCenter(new OpenLayers.LonLat(0, 0), 0);
71 map.zoomToMaxExtent();
75 <body onload="init()">
76 <h1 id="title" style="display:inline;">Example Showing Browser Name</h1>
77 <h3 id="browserHeader" style="display:inline;"></h3>
82 Demonstrate a simple map that shows the browser name.
85 <div id="map" class="smallmap"></div>