Skip to content

Commit b52335b

Browse files
committed
Add fullscreen example
1 parent ee731ff commit b52335b

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

fullscreen.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* Copyright 2018 Google Inc. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* @author ebidel@ (Eric Bidelman)
17+
*/
18+
19+
/**
20+
* Launch a URL in full screen.
21+
*/
22+
23+
const puppeteer = require('puppeteer');
24+
25+
const url = process.env.URL || 'https://news.ycombinator.com/';
26+
27+
(async() => {
28+
29+
const browser = await puppeteer.launch({
30+
headless: false,
31+
// See flags at https://peter.sh/experiments/chromium-command-line-switches/.
32+
args: [
33+
'--disable-infobars', // Removes the butter bar.
34+
'--start-maximized',
35+
// '--start-fullscreen',
36+
// '--window-size=1920,1080',
37+
// '--kiosk',
38+
],
39+
});
40+
41+
const page = await browser.newPage();
42+
await page.setViewport({width: 1920, height: 1080});
43+
await page.goto(url);
44+
await page.evaluate('document.documentElement.webkitRequestFullscreen()');
45+
await page.waitFor(5000);
46+
47+
await browser.close();
48+
})();

0 commit comments

Comments
 (0)