-
Notifications
You must be signed in to change notification settings - Fork 2
/
iframe_example.html
46 lines (44 loc) · 1.1 KB
/
iframe_example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Веб-ГИС «Устная память</title>
</head>
<body>
<iframe
id="map"
src=""
width="100%"
frameborder="0"
scrolling="no"
style="
border: none;
display: block;
min-width: 100% !important;
height: 537px;
"
></iframe>
</body>
<script>
var iframe = document.getElementById('map');
var src = 'https://pastandnow.staging.nextgis.com';
var url = new URL(window.location.href);
var id = url.searchParams.get('id');
if (id) {
src += '?id=' + id;
}
iframe.src = src;
window.addEventListener(
'message',
(event) => {
if (event.origin === 'https://pastandnow.staging.nextgis.com') {
var data = JSON.parse(event.data);
window.history.replaceState(null, null, '?id=' + data.detail );
}
},
false
);
</script>
</html>