Autodesk 15606-011408-9300 Developer Guide - Page 32
Overview, Map Access for ActiveX Control and Plug-In
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 32 highlights
Overview Netscape® Navigator® and Microsoft® Internet Explorer® expose map objects at different levels in their object hierarchies. Therefore, how you access a map is determined by the browsers you are supporting, not by the version of Autodesk MapGuide® Viewer you use. As described in this chapter, you can write a simple function that checks the user's browser type and returns an instance of the MGMap object using the technique required by that browser. Note that we refer to JavaScript code modules as functions, reserving the term method for the Autodesk MapGuide Viewer API. Once you've obtained the map object, your application code uses that instance when it calls methods in the Autodesk MapGuide Viewer API. In most cases, the code for either browser will be identical. Map Access for ActiveX Control and Plug-In This section describes how to access maps from both Netscape Navigator and Internet Explorer. The techniques described here use JavaScript as the scripting language. Because Internet Explorer automatically recompiles JavaScript code into its native JScript, you can write JavaScript code that works with either browser. Suppose you embedded your map and named it map. In Netscape Navigator, the map object called map is exposed by the document object and can be accessed from JavaScript in one of the following ways: document.map // one way... document.embeds["map"] // another way... In Internet Explorer, the map object called map is exposed by the window object and can be accessed from JavaScript in one of the following ways: window.map map // one way... // another way... The easiest way get around these differences is to write a getMap function that checks the browser type and returns the appropriate map object; that function can then be called as needed by the rest of the code in your application. 32 | Chapter 3 Accessing Maps