How to make an iFrame go fullscreen with JS from its inside?
I have an iFrame content that I use on third party websites.
I'm trying to get this iFrame content to go in full-screen browser mode.
This works OK when using the content alone as main document, but not on these third party websites (lms), that have often several iFrames nested, and my content is always the final nested one of course.
What I don't understand is that document.body.webkitRequestFullScreen()
is well defined in my document but it returns undefined
.
I'm making an hypothesis: Do all nested iFrames need to have the allowFullScreen
attribute? Or Can the full-screen work if only the upper iFrame have it?
And if my problem comes from this attribute, is there a way to allowFullScreen to all parents iFrames of the document?
javascript html iframe
add a comment |
I have an iFrame content that I use on third party websites.
I'm trying to get this iFrame content to go in full-screen browser mode.
This works OK when using the content alone as main document, but not on these third party websites (lms), that have often several iFrames nested, and my content is always the final nested one of course.
What I don't understand is that document.body.webkitRequestFullScreen()
is well defined in my document but it returns undefined
.
I'm making an hypothesis: Do all nested iFrames need to have the allowFullScreen
attribute? Or Can the full-screen work if only the upper iFrame have it?
And if my problem comes from this attribute, is there a way to allowFullScreen to all parents iFrames of the document?
javascript html iframe
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window usingwindow.open()
– charlietfl
Nov 15 '18 at 18:11
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41
add a comment |
I have an iFrame content that I use on third party websites.
I'm trying to get this iFrame content to go in full-screen browser mode.
This works OK when using the content alone as main document, but not on these third party websites (lms), that have often several iFrames nested, and my content is always the final nested one of course.
What I don't understand is that document.body.webkitRequestFullScreen()
is well defined in my document but it returns undefined
.
I'm making an hypothesis: Do all nested iFrames need to have the allowFullScreen
attribute? Or Can the full-screen work if only the upper iFrame have it?
And if my problem comes from this attribute, is there a way to allowFullScreen to all parents iFrames of the document?
javascript html iframe
I have an iFrame content that I use on third party websites.
I'm trying to get this iFrame content to go in full-screen browser mode.
This works OK when using the content alone as main document, but not on these third party websites (lms), that have often several iFrames nested, and my content is always the final nested one of course.
What I don't understand is that document.body.webkitRequestFullScreen()
is well defined in my document but it returns undefined
.
I'm making an hypothesis: Do all nested iFrames need to have the allowFullScreen
attribute? Or Can the full-screen work if only the upper iFrame have it?
And if my problem comes from this attribute, is there a way to allowFullScreen to all parents iFrames of the document?
javascript html iframe
javascript html iframe
asked Nov 15 '18 at 18:04
jckjck
17519
17519
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window usingwindow.open()
– charlietfl
Nov 15 '18 at 18:11
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41
add a comment |
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window usingwindow.open()
– charlietfl
Nov 15 '18 at 18:11
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window using
window.open()
– charlietfl
Nov 15 '18 at 18:11
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window using
window.open()
– charlietfl
Nov 15 '18 at 18:11
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53325451%2fhow-to-make-an-iframe-go-fullscreen-with-js-from-its-inside%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53325451%2fhow-to-make-an-iframe-go-fullscreen-with-js-from-its-inside%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
All that nesting is likely very problematic due to same origin policy. You might be better off providing link inside your iframe that would open your page in a new window using
window.open()
– charlietfl
Nov 15 '18 at 18:11
It would be a workaround, but in this case the nesting is used to communicate with a SCORM API through the DOM.
– jck
Nov 15 '18 at 23:41