Multimap API v1.1 Example

Browser Compatibility Example

The Multimap API relies on a set of JavaScript features being available within the map viewer. Because the lack of these features causes the viewer not to display correctly, a function has been made available that can be used to confirm whether the user's browser is compatible. This function is called MMIsSupportedBrowser() and returns true if the browser should be capable of viewing the map viewer.

If JavaScript is not enabled in a user's browser, the MMIsSupportedBrowser() function cannot run. In this circumstance, we would recommend the use of <noscript></noscript> tags. It is also worth noting that, if JavaScript is turned on but the browser is not supported, the browser is unlikely to support any more modern technologies such as the DOM, in which case the most basic JavaScript must be used.

What You Should See

What you see on this page will vary depending on the browser that you use and whether or not JavaScript is turned on in your browser. If you view this in a compatible browser you should see a Multimap draggable map centered on Fleet Street, London, Great Britain, at zoom factor 15.

The example uses a combination of <noscript></noscript> and JavaScript to handle incompatible browsers. It first uses JavaScript and the MMIsSupportedBrowser() function to determine if the browser is compatible. If not, a line of text is output using the document.write() method informing the user that his browser is not supported. Following this, <noscript></noscript> tags are used in case JavaScript is not enabled in the browser. Finally, MMIsSupportedBrowser() is used again to confirm that the browser is compatible in the onload function, to ensure that it is safe to try generating the map viewer.

If you are not using a compatible browser, but JavaScript is turned on, you should see this message: "Sorry! Your browser is not supported by the Multimap API.". If JavaScript is turned off you should see the message: "Your browser does not appear to support JavaScript, or JavaScript is not turned on. The Multimap API requires a modern browser with full JavaScript support".

The Map

The Code

There are three parts to the code below. The first is the line that links to the Multimap API. The second is an example of the HTML you must have in your page. The third is an example of the JavaScript required to implement the page.

The header code


<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/demo"></script>
    

The body code


  <!-- The Multimap Map-->
  <div id="mapviewer" style="width : 500px; height : 420px;">
  <script type="text/javascript" language="JavaScript">
  //<![CDATA[
     if( ! MMIsSupportedBrowser() )
     {
        document.write( '<p>Sorry! Your browser is not supported by the Multimap API.</p>' );
     }
  //]]>
  </script>
  <noscript>
     <p>Your browser does not appear to support JavaScript , or JavaScript  is not turned on.
	The Multimap API requires a modern browser with good JavaScript  support.</p>
  </noscript>
  </div>

The JavaScript code


var mapviewer;
     
function onLoad()
{
     //Add the map 
     if( MMIsSupportedBrowser() )
     {
          mapviewer = new MultimapViewer( document.getElementById( 'mapviewer' ) );
          mapviewer.drawAndPositionMap( new MMLocation( new MMLatLon( 51.5145, -0.1085 ) ,15 ) );
     }
}
  
MMAttachEvent( window, 'load', onLoad );

For more information on the subject of Multimap API JavaScript code, please read the API documentation at: http://www.multimap.com/share/mapviewerapidocs/1.1/index.html.

Further Help

If you require further help with your map API implementation, please contact our Customer Support team:

Australia, Sydney + 61 (0) 2 9262 6551
Great Britain, London +44 (0)20 7632 7777
United States, Boston + 1 617 423 4510
email: info@multimap.com

For general account enquiries or further services, please contact your Multimap Sales team:

Australia, Sydney + 61 (0) 2 9262 6551
Great Britain, London +44 (0)20 7632 7800
United States, Boston + 1 617 423 4510
email: sales@multimap.com