-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocs-embed-example.html
More file actions
41 lines (37 loc) · 1.12 KB
/
docs-embed-example.html
File metadata and controls
41 lines (37 loc) · 1.12 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Google Docs Embed Example</title>
<style>
.docs-container {
width: 100%;
height: 600px;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<h1>Embedded Google Doc</h1>
<!-- Replace DOCUMENT_ID with actual Google Docs document ID -->
<iframe
src="https://docs.google.com/document/d/DOCUMENT_ID/edit?usp=sharing&embedded=true"
class="docs-container"
frameborder="0">
</iframe>
<script>
// JavaScript to interact with the embedded document
function openDocInNewTab() {
const docId = 'YOUR_DOCUMENT_ID';
window.open(`https://docs.google.com/document/d/${docId}/edit`, '_blank');
}
// You can also create links dynamically
function createDocLink(docId, title) {
const link = document.createElement('a');
link.href = `https://docs.google.com/document/d/${docId}/edit`;
link.textContent = title;
link.target = '_blank';
return link;
}
</script>
</body>
</html>