Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Replace CONFIG_TAG_HERE with your tag

Replace VIEW_ACCESS_TOKEN_HERE if you are embedding a map view. If not, this url parameter must be removed.

Code Block
languagehtml
<iframe id="mazemap-app-iframe" width="100%" height="420" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://use.mazemap.com/?config=CONFIG_TAG_HERE&utmview_access_medium=iframetoken=VIEW_ACCESS_TOKEN_HERE" style="border: 1px solid grey" allow="geolocation"></iframe>

...

Code Block
languagejs
// Example code on customer web page
// When opening link such as:
// https://your-domain.com/maps/?mazemap_share_url=https%3A%2F%2Fuse.mazemap.com%2F%23v%3D1%26config%3Dcustomer-example-config%26center%3D10.407538%2C63.432910%26zoom%3D19%26zlevel%3D6%26utm_medium%3Dcustom_share_url

// Read the url
const url = new URL(location.href)

// Get the mazemap share url
const mazemapUrlmazemapUrlString = url.searchParams.get('mazemap_share_url')

if (mazemapUrl) {
    try {
      // Attempt to convert the url string into a proper URL
      // Update If the url is not valid or malformed, this will fail and
      // end up in the catch block.
      const url = new URL(string);

      // After valid url parsing, update the iframe with the correctshared sharedmazemap url:
      document.getElementById("mazemap-app-iframe").src = mazemapUrl; url.href;
    } catch (e) {
        console.error("Error valiadating url", e);
    }
}