Skip to content

Same Origin Policy exception #22

Open
@prushforth

Description

@prushforth

MapML, like HTML, is a hypertext format. Among other things, this means that it has embedded links to resources, particularly images, tiles and other MapML documents which compose a map layer.

SVG, also a hypertext format, is affected by the Same Origin Policy in the way that when it is loaded by the <img src="test.svg" width="100" height="100"> tag, resources that it links to are not loaded, regardless of origin. For example, this HTML document:

<html>
  <head>
    <title>svg-linked image</title>
    <meta charset="utf-8"/>
  </head>
  <body>
	<img src="test.svg" width="100" height="100">
<svg width=100 height=100>       
  <image href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="100" width="100"/>    
</svg>

  </body>
</html>

renders like this in chrome:

image

The content of test.svg is as follows:

<svg width="100" height="100" 
     xmlns="http://www.w3.org/2000/svg" 
     xmlns:xlink="http://www.w3.org/1999/xlink">       
  <image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="200" width="200"/>    
</svg>

The same relationship exists between a MapML document and remote resources, except it is more important for MapML, because virtually everything is drawn by compositing external resources onto the map canvas.

This will mean that the proposed <layer src="test.mapml"> will have to negotiate an exception to this (mis-)application of the Same Origin Policy.

Hat tip to Amelia's book for bringing this to my attention.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions