Gathering detailed insights and metrics for es-screenfull
Gathering detailed insights and metrics for es-screenfull
Gathering detailed insights and metrics for es-screenfull
Gathering detailed insights and metrics for es-screenfull
npm install es-screenfull
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Total Downloads
4,484
Last Day
1
Last Week
3
Last Month
17
Last Year
226
MIT License
2 Commits
3 Watchers
1 Branches
1 Contributors
Updated on Jan 22, 2019
Minified
Minified + Gzipped
Latest Version
3.0.2-patch
Package Id
es-screenfull@3.0.2-patch
Unpacked Size
11.35 kB
Size
4.45 kB
File Count
5
NPM Version
6.2.0
Node Version
10.9.0
Cumulative downloads
Total Downloads
5
Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen. Smoothens out the browser implementation differences, so you don't have to.
🔥 Want to strengthen your core JavaScript skills and master ES6?
I would personally recommend this awesome ES6 course by Wes Bos.
Only 0.7 kB gzipped.
Download the production version or the development version.
$ npm install --save screenfull
Also available on cdnjs.
1if (screenfull.enabled) { 2 screenfull.request(); 3}
1document.fullscreenEnabled = document.fullscreenEnabled || document.mozFullScreenEnabled || document.documentElement.webkitRequestFullScreen; 2 3function requestFullscreen(element) { 4 if (element.requestFullscreen) { 5 element.requestFullscreen(); 6 } else if (element.mozRequestFullScreen) { 7 element.mozRequestFullScreen(); 8 } else if (element.webkitRequestFullScreen) { 9 element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); 10 } 11} 12 13if (document.fullscreenEnabled) { 14 requestFullscreen(document.documentElement); 15} 16 17// Actually it's more if you want it to work in Safari, but let's not go there...
Safari doesn't support use of the keyboard in fullscreen.
1document.getElementById('button').addEventListener('click', () => { 2 if (screenfull.enabled) { 3 screenfull.request(); 4 } else { 5 // Ignore or do something else 6 } 7});
1const elem = document.getElementById('target'); 2 3document.getElementById('button').addEventListener('click', () => { 4 if (screenfull.enabled) { 5 screenfull.request(elem); 6 } 7});
1const target = $('#target')[0]; // Get DOM element from jQuery collection 2 3$('#button').on('click', () => { 4 if (screenfull.enabled) { 5 screenfull.request(target); 6 } 7});
1$('img').on('click', event => { 2 if (screenfull.enabled) { 3 screenfull.toggle(event.target); 4 } 5});
1if (screenfull.enabled) { 2 document.addEventListener(screenfull.raw.fullscreenchange, () => { 3 console.log('Am I fullscreen? ' + (screenfull.isFullscreen ? 'Yes' : 'No')); 4 }); 5}
1if (screenfull.enabled) {
2 document.addEventListener(screenfull.raw.fullscreenerror, event => {
3 console.error('Failed to enable fullscreen', event);
4 });
5}
See the demo for more examples, and view the source.
You can use the Angular.js binding to do something like:
1<div ngsf-fullscreen> 2 <p>This is a fullscreen element</p> 3 <button ngsf-toggle-fullscreen>Toggle fullscreen</button> 4</div>
Make an element fullscreen.
Accepts a DOM element. Default is <html>
. If called with another element than the currently active, it will switch to that if it's a decendant.
If your page is inside an <iframe>
you will need to add a allowfullscreen
attribute (+ webkitallowfullscreen
and mozallowfullscreen
).
Keep in mind that the browser will only enter fullscreen when initiated by user events like click, touch, key.
Brings you out of fullscreen.
Requests fullscreen if not active, otherwise exits.
Returns a boolean whether fullscreen is active.
Returns the element currently in fullscreen, otherwise null
.
Returns a boolean whether you are allowed to enter fullscreen. If your page is inside an <iframe>
you will need to add a allowfullscreen
attribute (+ webkitallowfullscreen
and mozallowfullscreen
).
Exposes the raw properties (prefixed if needed) used internally: requestFullscreen
, exitFullscreen
, fullscreenElement
, fullscreenEnabled
, fullscreenchange
, fullscreenerror
1$(document).on(screenfull.raw.fullscreenchange, () => { 2 console.log('Fullscreen change'); 3});
That's not supported by browsers for security reasons. There is, however, a dirty workaround. Create a seamless iframe that fills the screen and navigate to the page in that instead.
1$('#new-page-btn').click(() => { 2 const iframe = document.createElement('iframe') 3 4 iframe.setAttribute('id', 'external-iframe'); 5 iframe.setAttribute('src', 'http://new-page-website.com'); 6 iframe.setAttribute('frameborder', 'no'); 7 iframe.style.position = 'absolute'; 8 iframe.style.top = '0'; 9 iframe.style.right = '0'; 10 iframe.style.bottom = '0'; 11 iframe.style.left = '0'; 12 iframe.style.width = '100%'; 13 iframe.style.height = '100%'; 14 15 $(document.body).prepend(iframe); 16 document.body.style.overflow = 'hidden'; 17});
MIT © Sindre Sorhus
No vulnerabilities found.
Reason
0 existing vulnerabilities detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/2 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
0%
1
Compared to previous day
Last Week
-40%
3
Compared to previous week
Last Month
13.3%
17
Compared to previous month
Last Year
-31.3%
226
Compared to previous year