]> dev.renevier.net Git - syp.git/blob - openlayers/examples/browser-name.html
avoid html injection in item title
[syp.git] / openlayers / examples / browser-name.html
1 <html xmlns="http://www.w3.org/1999/xhtml">
2   <head>
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
10         var map = null;
11
12         function init(){
13
14             //set title name to include Browser Detection
15             // this is the only way to test the functionality
16             // of the getBrowserName() function
17             //
18             var header = OpenLayers.Util.getElement("browserHeader");
19             header.innerHTML = "(browser: ";
20             var browserCode = OpenLayers.Util.getBrowserName();
21             switch (browserCode) {
22                 case "opera":
23                     browserName = "Opera";
24                     break;
25                 case "msie":
26                     browserName = "Internet Explorer";
27                     break;
28                 case "safari":
29                     browserName = "Safari";
30                     break;
31                 case "firefox":
32                     browserName = "FireFox";
33                     break;
34                 case "mozilla":
35                     browserName = "Mozilla";
36                     break;
37                 default:
38                     browserName = "detection error"
39                     break;
40             }
41             header.innerHTML += browserName + ")";
42
43             map = new OpenLayers.Map('map');
44
45             var options = {
46                             resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
47             };
48
49             var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
50                 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'},
51                 options);
52
53             var options2 = {
54                             resolutions: [0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101]
55             };
56             var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
57                 "http://t1.hypercube.telascience.org/cgi-bin/landsat7", 
58                 {layers: "landsat7"}, options2);
59
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});
67
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();
72         }
73     </script>
74   </head>
75   <body onload="init()">
76     <h1 id="title" style="display:inline;">Example Showing Browser Name</h1>
77     <h3 id="browserHeader" style="display:inline;"></h3>
78
79     <div id="tags"></div>
80
81     <p id="shortdesc">
82         Demonstrate a simple map that shows the browser name.
83     </p>
84
85     <div id="map" class="smallmap"></div>
86
87     <div id="docs"></div>
88   </body>
89 </html>