Skip to content

Instantly share code, notes, and snippets.

@YazeedAlKhalaf
Created April 1, 2021 08:44
Show Gist options
  • Save YazeedAlKhalaf/9aec562f499b208f3f1023ca97f85e01 to your computer and use it in GitHub Desktop.
Save YazeedAlKhalaf/9aec562f499b208f3f1023ca97f85e01 to your computer and use it in GitHub Desktop.
(function () {
let toInsertDiv = document.createElement("div");
let toInsertObject = document.createElement("object");
let toInsertIframe = document.createElement("iframe");
let pdfSrcUrl = prompt("Please enter the PDF source url");
if (pdfSrcUrl == null) return;
let height = "787px";
let width = "600px";
toInsertObject.width = width;
toInsertObject.height = height;
toInsertIframe.width = width;
toInsertIframe.height = height;
toInsertIframe.src = pdfSrcUrl;
toInsertDiv.appendChild(toInsertObject);
toInsertObject.appendChild(toInsertIframe);
document
.getElementById("edit-comment-body_ifr")
.contentDocument.getElementById("tinymce")
.appendChild(toInsertDiv);
alert(
"Have Fun 🙈!"
);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment