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
68.8
Supply Chain
98.2
Quality
77.2
Maintenance
100
Vulnerability
100
License
Total Downloads
4,407
Last Day
2
Last Week
6
Last Month
18
Last Year
295
2 Commits
4 Watching
1 Branches
1 Contributors
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
Last day
0%
2
Compared to previous day
Last week
-14.3%
6
Compared to previous week
Last month
125%
18
Compared to previous month
Last year
-19.8%
295
Compared to previous year
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
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool 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 effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-12-23
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 More