NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


I would like to use OSM as a location setter on my page. The user should be able to move the marker on the map and then save the location to the database and next time when he/she opens it, the marker should be on the new place. However the marker is not moveable if OSM is embedded. I found no information about how can i move the marker on an embedded OSM iframe. Any ideas on this?

asked 16 Jan '22, 15:25

TCH68k's gravatar image

accept rate: 0%

You won't be able to achieve this if you are using the iframe embed option. Reason: all browsers have a cross origin security policy that does not allow your website to intercept any interactions a user would have with the map in the iframe.

You would rather have to include the map through a web library like Leaflet ( ) that would give you the chance to orchestrate the interaction with the map. Maybe a leaflet plugin like would be a start (but it does not save to a database but rather just uses an url to set the information).

permanent link

answered 17 Jan '22, 09:14

Spiekerooger's gravatar image

accept rate: 16%

I can read the iframe's src and see the changes from the URL, but that's not important. How can i move the marker if OSM is embedded? Even if i cannot detect the changes. How can i move the marker?

(17 Jan '22, 12:55) TCH68k

If you would go the embed way you would not only have to manipulate the marker lat/lon parameter but also calculate the surrounding bbox values to get the right iframe url for your users. So it is much easier to do this in using a library like Leaflet and start from there.

(17 Jan '22, 13:28) Spiekerooger

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Jan '22, 15:25

question was seen: 1,359 times

last updated: 17 Jan '22, 13:40

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum