简体   繁体   中英

Create a web page without window title bar

This is an updated question based on feedback from "glautrou": I have an LCD Cape coming for a BeagleBone Black single board computer and I want to have a web page displayed on the LCD with no borders, no scroll bars, and NO TITLE BAR. I am experimenting with getting this to work using the below code which was cut down from an example located at http://lesson8.blogspot.co.uk/2013/01/html5-fullscreen-api.html .

My desire is to have this run either when the page loads or from within a script...and NOT requiring the press of a button. The below script works fine with the button but does not work with either the open or script invocations. I will admit now that I don't really understand the DOM so I suspect that I am missing something simple.

<!DOCTYPE html>
<html>
<head>
</head>
<BODY onLoad="launchFullscreen(document.documentElement);">
<h1>HTML5 Fullscreen API</h1>

<div style="padding:20px;">
    <button onclick="launchFullscreen(document.documentElement);" class="sexyButton">Launch Fullscreen</button>
    <button onclick="cancelFullscreen();" class="sexyButton">Hide Fullscreen</button>
</div>

<script type='text/javascript'>//<![CDATA[ 

function launchFullscreen(element) {
  if(element.requestFullScreen) {
    element.requestFullScreen();
  } else if(element.mozRequestFullScreen) {
    element.mozRequestFullScreen();
  } else if(element.webkitRequestFullScreen) {
    element.webkitRequestFullScreen();
  }
}

function cancelFullscreen() {
  if(document.cancelFullScreen) {
    document.cancelFullScreen();
  } else if(document.mozCancelFullScreen) {
    document.mozCancelFullScreen();
  } else if(document.webkitCancelFullScreen) {
    document.webkitCancelFullScreen();
  }
}

launchFullscreen(document.documentElement);

//]]>  

</script>
</body>
</html>

Thanks in advance, Will

HTML5中有一个特定的全屏API,请查看HTML5全屏API与Jav​​aScript的切换以及本教程

I had lost sight of the fact that I am running an embedded (single user) application here...when that re-occurred to me I looked for a way to send keystrokes to the browser. I found, and installed, xdotool as it was packaged for angstrom, and wrote a little autostart script. It works a charm though I will now automate it a little better via my node.js application. Thanks for the help, Will

Another way to meet my requirement given that I am running Chrome...

chrome.exe --kiosk --incognito some.web.site

Kiosk does the full screen thing and incognito prevents the question about restoring sessions in the case of an ungraceful shutdown.

This is what I needed regardless of what I may have thought that I needed!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM