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

javascript - window.fullScreen=true is not working - Stack Overflow

programmeradmin4浏览0评论

I would like to open my html page in fullscreen mode. I tried to execute this javascript in body's onload event handler.

window.fullScreen = true;

But unfortunately that doesn't seem to be working. Is there any other way with which we can achieve the same.

I would like to open my html page in fullscreen mode. I tried to execute this javascript in body's onload event handler.

window.fullScreen = true;

But unfortunately that doesn't seem to be working. Is there any other way with which we can achieve the same.

Share Improve this question edited Sep 21, 2011 at 17:26 abatishchev 100k88 gold badges301 silver badges442 bronze badges asked Jun 23, 2009 at 6:33 shafishafi 1
  • possible duplicate of How to make in Javascript full screen windows (stretching all over the screen) – Simon Lieschke Commented Feb 2, 2012 at 13:39
Add a comment  | 

6 Answers 6

Reset to default 5

I dont think you can set the windows properties by using the onload event. Try setting the properties as you open the window. This should work...

<div onclick="window.open('http://stackoverflow.com', 'Stackoverflow' , 'type=fullWindow, fullscreen, scrollbars=yes');">
    Hello Stackoverflow!
</div>

This is unadvisable as it results in unexpected browser behviour for the user. For this reason, many browsers no longer let unprivileged scripts modify this setting.

For example, from Mozilla Developer Center

With chrome privileges, the property is read-write, otherwise it is read-only.

See https://developer.mozilla.org/En/DOM/Window.fullScreen

I'm pretty sure that most browsers block this nowadays as it's annoying.

Chrome 15, Firefox 10, and Safari 5.1 now provide APIs to programmatically trigger fullscreen mode.

See this hacks.mozilla.org blog post for details.

window.open(href, windowname, ',type=fullWindow,fullscreen,scrollbars=yes');

take it from link : http://www.htmlcodetutorial.com/linking/linking_famsupp_87.html

Try this script

<script language="JavaScript">
function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto' );
}
</script>

For calling form script use

window.fullScreen('fullscreen.jsp');

or with hyperlink

<a href="javascript:void(0);" onclick="fullScreen('fullscreen.jsp');"> 
Open in Full Screen Window</a>
发布评论

评论列表(0)

  1. 暂无评论