Bookmarklet

From OpenStreetMap Wiki
Jump to navigation Jump to search

Bookmarklet are small pieces of JavaScript code which you store and run on-demand in your browser to conveniently access tools for your OSM work! For general info see Wikipedia about “bookmarklet”.

Which tools can be accessed via bookmarklets?

Bookmarklets can be easily written for all web-based tools which accept parameters via HTTP GET.

A simple list of all wiki pages linking to here – these pages may link to here because someone has made and published a bookmarklet for the described tool.

How-to set up

  • 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. See German forum discussion for details.
  • create a bookmark in your browser, and use the bookmarklet JavaScript code as URL. This could be achieved by bookmarking some arbitrary page and then editing the bookmark (maybe via the bookmark manager in your browser): Copy and paste the code into the URL field.
  • (the following method is not possible in this wiki) If you use the bookmark toolbar and if the bookmarklet is available as link then you can juse drag it do the toolbar.

How-to use

Usually by

  • clicking on the bookmark button in the bookmark toolbar,
  • selecting the bookmark from the list of bookmarks,
  • or opening the bookmark via a keyword/shortcut

while visiting another page on osm.org.

How-to code

A tip:

  • jsbeautifier.org may be useful to de-encode the JavaScript code (at least firefox does URIencode the bookmarklet's code on saving it).
  • Use jshint.com to check for errors.

See also

  • OSM Smart Menu - A browser extension to help the OpenStreetMap community easily access different maps and tools to analyze OSM data.
  • Better-osm-org - User script to enhance openstreetmap.org