This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

javascript bookmarklet fails to load Mapillary website

0

Hi This is only semi related to OSM, but I'm hoping someone here with expert knowledge can help me.

I'm using this bookmarklet to scrape the co-ordinates from OSM's URL & transferring them to a URL to loaded the equivalent location in Mapillary.

javascript:(function(){var%20a=/map=(\d+)\/(-?\d+(.\d*)?)\/(-?\d+(.\d*)?)/.exec(window.location.hash);window.open("https://www.mapillary.com/app/?lat="+a[2]+"&lng="+a[4]+"&z="+a[1])}())

For some reason it stopped working on the main OSM page. I'm using Firefox & sure there wasn't an update when the failure occurred. I've also failed on a old version of Firefox (43) but works in an old copy of IE.

It still works in the edit screen of Potlatch, but not iD.

I check site permissions but P2 & iD use the same https://www.openstreetmap.org

What has changed?

asked 10 Jul '18, 13:09

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%


One Answer:

0

What has changed? openstreetmap.org has a strict CSP since a day in May 2018.

See https://wiki.openstreetmap.org/wiki/Bookmarklet : "use a browser which supports bookmarklets on pages with a strict CSP (openstreetmap.org has one since May 2018). Firefox does not work; Chromium works."

I do not understand why it works on a P2 edit page.

Workaround (for many cases but not for your case): For osm object IDs I use Firefox' special bookmark placeholder %s in my bookmarks - see https://forum.openstreetmap.org/viewtopic.php?pid=675076#p675076 . In your case I see no simple workaround. Try to use Chromium/Chrome instead of Firefox of you want to avoid IE.

answered 13 Jul '18, 22:10

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554
accept rate: 18%

edited 13 Jul '18, 22:12

Source code available on GitHub .