diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2024-01-14 00:23:53 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2024-01-14 04:14:17 +0100 |
commit | ede24258052a37ab6db54553a3d4d846b1870b6c (patch) | |
tree | 76e890299bda5af56f21dd775e2a8a4e4d89f5e8 /main.js | |
parent | a95bd079fd3b2639c0c1e4b0b637fa67c0a2e4ac (diff) |
Add an example with a page containg the map in an <iframe>.
Diffstat (limited to 'main.js')
-rw-r--r-- | main.js | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -329,3 +329,10 @@ document.getElementById('layer-topowebb_nedtonad').onchange = function(event) { const layer = event.target.checked ? 'topowebb_nedtonad' : 'topowebb'; baseMapSource.setUrl('https://minkarta.lantmateriet.se/map/topowebbcache?LAYER=' + layer); }; + +map.on('singleclick', function (event) { + const size = map.getSize(); + if (window.location !== window.parent.location && (size[0] < 576 || size[1] < 576)) { + return window.open(window.location, '_blank'); + } +}); |