Closed andyb-esdm closed 5 years ago
Discussion with JNCC means it is likely we will use the querystring strategy that represents the difference between the map instance and the current state of the map. The mapper will need to be able to parse this and set the map to the settings in the querystring. Still need to determine how/whether this querystring appears in the hosting page/escapes the iframe (alternatively the permalink should be direct to the mapping page (without the hosting page around it)).
Some initial thoughts:
If a small amount of javascript could be placed onto the page that holds the Iframe. e.g. on this page: http://jncc.defra.gov.uk/default.aspx?page=7718, then we could implement permalinks on the mapper that correctly reference the parent. A permalink might then become something like: http://jncc.defra.gov.uk/default.aspx?page=7718&permalinkdata=xxxxxxxxxxxxxxxxxxxxxxxxxx
The javascript should set the src of the iframe to the web-mapper component and also pass in three parameters in the get URL
If the web-mapper receives 1. then it knows to adjust the permalinks it generates to have the parent pages URL, not the url of the Iframe itself. Need to decide what these parameters are called - I just used mi, pd and pu as examples.
An iframe src url could consist of http(s)://web-mapper-hostname/?mi=mapInstance-name&pd=encodedPermalinkData&pu=encodedParentURL
Not all CMS's will understand parameters as part of URLs (e.g. /1/2/3), so the actual permalinks generated by the map should be done using query string format. If parameter pu was received (and contained the link http://jncc.defra.gov.uk/default.aspx?page=7718) then the permalink generated would look like this: http://jncc.defra.gov.uk/default.aspx?page=7718&mi=mapInstance-name&pd=encodedPermalinkData
If no pu parameter received then we get the url of the web-mapper itself: http(s)://web-mapper-hostname/?mi=mapInstance-name&pd=encodedPermalinkData
If it is not possible to include javascript within the CMS page source then I can't see how we would make permalinks work correctly for maps within an Iframe.
Linked to #38