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

javascript to open links in umap marker description in parent page containing the iframe

0

Hello everybody,

other people seem to have had this problem already, but I could not find a viable solution for my case. I have a UMap with some location markers that show projects. This UMap is shown in an iframe embedded on the projects' website. Each project has its own page with detailed information. I have put a link to each project's page in the marker description, but I would like these links to open in the window with the iframe page, since they are all on the same website.

I found a little script on the web which I tried:

function onLoadIF(frame)
{
    var elements = frame.getElementsByTagName('a'),
        len = elements.length;

    while( len-- ) {
        elements[len].target = "_parent";
    }
}

This doesn't work however, since the map is also generated by javascript. Is there any way of accessing those links in the descriptions by javascript so I can change their targets?

Many thanks in advance for your ideas and help!

asked 13 Jul '20, 14:23

Netzhexe's gravatar image

Netzhexe
101235
accept rate: 0%

Source code available on GitHub .