Improve window open and close handling

Use pagehide event instead of beforeunload, seems to be more reliable
Add a timeout and info message when opening the window fails
This commit is contained in:
Maximilian Krög
2021-10-20 01:18:05 +02:00
parent 5149224354
commit 7bed63bf3f
3 changed files with 46 additions and 27 deletions

View File

@@ -1,11 +1,11 @@
---
layout: example.html
title: External map
shortdesc: Show a map in a separate window.
shortdesc: Move a map to a seperate window.
docs: >
Move a map to a seperate window.
tags: "external, window"
resources:
---
<div id="map" class="map"></div>
<input id="extMap" type="button" value="Open external map"></input>
<input id="external-map-button" type="button" value="Open external map"></input>
<span id="blocker-notice" hidden>Could not open map in external window. If you are using an popup or ad blocker you may need to disable it for this example.</span>