-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
38 lines (38 loc) · 982 Bytes
/
index.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
<!DOCTYPE html>
<html lang=en>
<head>
<script src=https://apis.google.com/js/api.js></script>
<style>
iframe {
border: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<iframe id=content></iframe>
<script>
const params = new URLSearchParams(document.location.search)
gapi.load('client', () => {
gapi.client.init({
apiKey: params.get('key'),
discoveryDocs: ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest']
}).then(() => {
gapi.client.drive.files.get({
fileId: params.get('id'),
alt: 'media'
}).then(response => {
const doc = document.getElementById('content').contentWindow.document
doc.open()
doc.write(response.body)
doc.close()
})
})
})
</script>
</body>
</html>