Passing Viewer Information to the Web Server

The Viewers, especially the DWF Viewer, manage many details about the state of the active map. These details are not always directly available to the Web Server. They are local to the Viewer, and are available through JavaScript calls to the Viewer API.

A good example of this is the active selection. The DWF Viewer maintains the active selection. To avoid excessive traffic between the Viewer and the Web Server, the Viewer does not notify the Web Server when the active selection changes.

Because of this, when the Viewer makes a request to a MapGuide Server Page on the Web Server, it must often pass information as part of the request. Some common methods for passing this information are:

- as an additional parameter to an Invoke URL command in a web layout
- through an Invoke Script command that executes the Submit method of the hidden formFrame
- through an onClick or other event that executes the Submit method of the hidden formFrame

The best method to use depends on the requirements of the application. If you are invoking the request from a command defined in a web layout, you can pass the information either as an additional parameter to an Invoke URL command or through an Invoke Script command. Invoke URL is simpler, but it offers a restricted set of parameters. Invoke Script has complete access to all the JavaScript calls in the Viewer API.

If you are invoking the request from a page in the task pane, you can execute JavaScript as part of an onClick event or a form action.

#### Topics in this section

- Additional Parameters to an Invoke URL Command
- Passing Parameters From an Invoke Script command
- Passing Parameters From the Task Pane Frame