From bdba39afd2b0cf44e924b85555bcfa061f9c8f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Jockusch?= Date: Wed, 8 May 2019 07:21:19 +0200 Subject: [PATCH] Same source issue solved. fullscreenToggle now checks if it is permitted to inspect other iframes. --- app/ui.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/ui.js b/app/ui.js index 91bd2d3a..d90025ed 100644 --- a/app/ui.js +++ b/app/ui.js @@ -1198,13 +1198,17 @@ const UI = { let doc_el = document.documentElement; if (window.self !== window.top) { // Seek out the correct iframe from the parent document. - // This will produce errors if the iframe does not come from - // the same origin, so it is advisable to put the viewer in - // iframes only if you are on the same server. let iframes = window.parent.document .getElementsByTagName('iframe'); for (let i in iframes) { - if (iframes[i].contentDocument === document) { + let content_doc = null; + try { + content_doc = iframes[i].contentDocument; + } catch (err) { + // I may not be permitted to read the contentDocument + // of the iframe, but then it can't be me, so ignore. + } + if (content_doc === document) { doc_el = iframes[i]; // To use .body.msRequestFullscreen in IE, we need to // set the document element accordingly.