forked from GameDistribution/GD-HTML5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_iframe.html
52 lines (52 loc) · 1.8 KB
/
index_iframe.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
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<title>Gamedistribution.com HTML5 Self-Hosted Game Wrapper</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style>
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
}
#container {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
overflow: hidden;
max-width: 100%;
max-height: 100%;
min-width: 100%;
min-height: 100%;
box-sizing: border-box;
}
</style>
</head>
<body>
<iframe id="container" frameborder="0" allow="autoplay" allowfullscreen seamless="seamless" scrolling="no"></iframe>
<script type="application/javascript">
function getParentUrl() {
var url = (window.location !== window.parent.location)
? (document.referrer && document.referrer !== '')
? document.referrer
: document.location.href
: document.location.href;
if (document.referrer.indexOf('localhost') !== -1) {
url = 'https://gamedistribution.com/';
}
return url;
}
// Add the self-hosted game url as value of gameUrl.
var gameUrl = 'http://example.io';
document
.getElementById('container')
.src = gameUrl + '?gd_sdk_referrer_url=' + getParentUrl();
</script>
</body>
</html>