Reputation: 126085
I have to use Javascript for a link (at least I think so) in my openlayers map:
map.on("click", e => {
map.forEachFeatureAtPixel(e.pixel, (feature) => {
window.location.href = "/s/" + feature.getId();
return true; // stop after first feature
});
});
This works fine, but lacks some things:
I thought about listening to hover and checking if command is pressed, but this seems error prone and only works for known system configurations.
Is there a way to make a javascript link work just like a HTML link?
Upvotes: 0
Views: 77
Reputation: 105
you can wrap your map with < a > tag and update href accordingly, that would:
you can also look at window.open, although it might be registered as 'popup' and blocked.
Upvotes: 1