The Embedding API

From University Map Wiki
Revision as of 14:26, 30 July 2013 by jw35 (talk | contribs) (Note support for responsive design)
Jump to navigationJump to search

To embed a map in another web page, simply use an IFRAME, like this:

 <iframe src=url>(non-iframe text)</iframe>

where url is a standard map linking URL - see The Map URL API. For example:

 <iframe src=""></iframe>

Typically your CSS will set the width and height of the IFRAME, though you can also do this directly:

 <iframe src="" style="width: 400px; height: 400px;"></iframe>

The presentation is slightly different from the full page for the same URL in that only the map is displayed without any ancillary information, titling, branding etc. The height and/or width of the iframe can be specified relative to the height/width of its containing elements (e.g. "width: 100%"). If the containing element changes size, as is common in responsive design, the map will adapt to the new size.

We suggest not using the bounding box or ref form of URL for embedding a map relevant to an institution. By using the simple name of the institution or its code, then the map will

  • adjust if the institution moves (using  a bounding box or building reference leaves it showing the old geographical location)
  • centre on the institution concerned 
  • show a marker for just the institution concerned, not all of its neighbbours

The src link can include an annotation overlay or positioning fragment.

Note that if your page is served using HTTPS, you will also need to use https to retrieve the map, otherwise users will receive messages warning about mixed and unprotected content on the page:

 <iframe src=""></iframe>