最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

fullscreen - Put browser full screen and refresh on button click (simulate F11) JavaScript - Stack Overflow

programmeradmin0浏览0评论

I went through more than 10 questions with same content but not to find a updated answer. (world of web is changing rapidly I guess). First thing is, is it possible to put current window full screen simulating F11 press on a user button click. also what is the best practice for doing it if I want the function to work in all major browsers (IE, FF, Chrome and Safari).

How to make in Javascript full screen windows (stretching all over the screen)

Simulate F11 with javascript

onclick go full screen

including above links I went through lot of questions but had no susses. Its really helpful if someone can e up with an idea. Thanks.

I went through more than 10 questions with same content but not to find a updated answer. (world of web is changing rapidly I guess). First thing is, is it possible to put current window full screen simulating F11 press on a user button click. also what is the best practice for doing it if I want the function to work in all major browsers (IE, FF, Chrome and Safari).

How to make in Javascript full screen windows (stretching all over the screen)

Simulate F11 with javascript

onclick go full screen

including above links I went through lot of questions but had no susses. Its really helpful if someone can e up with an idea. Thanks.

Share Improve this question edited May 23, 2017 at 12:29 CommunityBot 11 silver badge asked Aug 6, 2013 at 8:52 DbxDDbxD 5503 gold badges15 silver badges29 bronze badges 9
  • Short answer: Not possible, the way you want it. The links you provided are as good as it gets. Alternative answer: Do NOT mess with my main browser window. Open a new one, please – mplungjan Commented Aug 6, 2013 at 8:53
  • It was possible earlier, isn't it? in this case I want to re-size the current window by offering the user go to full screen button. – DbxD Commented Aug 6, 2013 at 8:55
  • It was never possible to remove chrome from current window. IE allows(allowed) to open a new window and kill the current window which is something I call Denial Of Service if you do that to my window. I STRONGLY prefer a new window or do it like Chrome does here – mplungjan Commented Aug 6, 2013 at 9:00
  • 1 like this? fiddle.jshell/WWFXW/6/show/light see the implementation: jsfiddle/WWFXW/6 fsapi in first link of @ZaoTaoBao answer is very plete btw. Keep in mind that browser support is quite limited at the moment. Also, developer.mozilla/en-US/docs/Web/Guide/DOM/… – j03w Commented Aug 6, 2013 at 9:22
  • 1 That is the Chrome/Safari thing I mentioned. It works quite like F11 @j03w why not add as answer? – mplungjan Commented Aug 6, 2013 at 9:24
 |  Show 4 more ments

2 Answers 2

Reset to default 3

maybe this can help you example of full screen using the blog post Native Fullscreen JavaScript API (plus jQuery plugin)

This question is possibly a duplicate of a question you linked to. The latest cross-browser solution is:

function requestFullScreen(elt) {
    console.log("Requesting fullscreen for", elt);
    if (elt.requestFullscreen) {
        elt.requestFullscreen();
    } else if (elt.msRequestFullscreen) {
        elt.msRequestFullscreen();
    } else if (elt.mozRequestFullScreen) {
        elt.mozRequestFullScreen();
    } else if (elt.webkitRequestFullscreen) {
        elt.webkitRequestFullscreen();
    } else {
        console.error("Fullscreen not available");
    }
}

Please note that this is "experimental technology" as of this post. See this answer and this MDN page for more details.

发布评论

评论列表(0)

  1. 暂无评论