Created
January 29, 2021 13:34
-
-
Save saurav28/a18c5b02c3ad8956faa77ab4736198cd to your computer and use it in GitHub Desktop.
Load Google Docs in iframe dynamically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>SDM Google Integration</title> | |
<style> | |
body { | |
background-color: black; | |
text-align: center; | |
color: white; | |
font-family: Arial, Helvetica, sans-serif; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Embedding google doc as an iframe</h1> | |
<script> | |
function prepareFrame(docid) { | |
var ifrm = document.createElement("IFRAME"); | |
var src = "https://docs.google.com/document/d/" + docid + "/edit?embedded=true" | |
ifrm.setAttribute("src", src); | |
ifrm.style.width = "100vw"; | |
ifrm.style.height = "100vh"; | |
document.body.appendChild(ifrm); | |
} | |
prepareFrame('<pass the google id of a document owned by you'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment