Gathering detailed insights and metrics for screenfull
Gathering detailed insights and metrics for screenfull
Gathering detailed insights and metrics for screenfull
Gathering detailed insights and metrics for screenfull
@types/screenfull
Stub TypeScript definitions entry for screenfull, which provides its own types definitions
screenfull-react
Full screen experiences for mobile
es-screenfull
Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.
@ngx-extensions/screenfull
Wrapper module for screenfull
Simple wrapper for cross-browser usage of the JavaScript Fullscreen API
npm install screenfull
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.8
Supply Chain
99.5
Quality
76
Maintenance
100
Vulnerability
100
License
HTML (49.63%)
JavaScript (37.89%)
TypeScript (12.48%)
Total Downloads
334,314,028
Last Day
88,388
Last Week
2,230,583
Last Month
9,632,569
Last Year
103,121,672
MIT License
7,128 Stars
195 Commits
692 Forks
140 Watchers
1 Branches
25 Contributors
Updated on Jul 01, 2025
Minified
Minified + Gzipped
Latest Version
6.0.2
Package Id
screenfull@6.0.2
Unpacked Size
17.38 kB
Size
4.98 kB
File Count
5
NPM Version
8.3.2
Node Version
14.19.2
Cumulative downloads
Total Downloads
Last Day
-12.5%
88,388
Compared to previous day
Last Week
-9.9%
2,230,583
Compared to previous week
Last Month
1.5%
9,632,569
Compared to previous month
Last Year
18.8%
103,121,672
Compared to previous year
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.
This package is ESM. Please familiarize yourself with that that implies.
If you cannot use ESM or need to support older browsers without using transpilation, use version 5.2.0.
This package is feature complete. No new features will be accepted.
Only 0.7 kB gzipped.
1npm install screenfull
Also available on cdnjs (older version).
1import screenfull from 'screenfull'; 2 3if (screenfull.isEnabled) { 4 screenfull.request(); 5}
1document.fullscreenEnabled = 2 document.fullscreenEnabled || 3 document.mozFullScreenEnabled || 4 document.documentElement.webkitRequestFullScreen; 5 6function requestFullscreen(element) { 7 if (element.requestFullscreen) { 8 element.requestFullscreen(); 9 } else if (element.mozRequestFullScreen) { 10 element.mozRequestFullScreen(); 11 } else if (element.webkitRequestFullScreen) { 12 element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); 13 } 14} 15 16if (document.fullscreenEnabled) { 17 requestFullscreen(document.documentElement); 18} 19 20// This is not even entirely comprehensive. There's more.
Note: Safari is supported on desktop and iPad, but not on iPhone. This is a limitation in the browser, not in Screenfull.
1import screenfull from 'screenfull'; 2 3document.getElementById('button').addEventListener('click', () => { 4 if (screenfull.isEnabled) { 5 screenfull.request(); 6 } else { 7 // Ignore or do something else 8 } 9});
1import screenfull from 'screenfull'; 2 3const element = document.getElementById('target'); 4 5document.getElementById('button').addEventListener('click', () => { 6 if (screenfull.isEnabled) { 7 screenfull.request(element); 8 } 9});
1import screenfull from 'screenfull'; 2 3const element = document.getElementById('target'); 4 5document.getElementById('button').addEventListener('click', () => { 6 if (screenfull.isEnabled) { 7 screenfull.request(element, {navigationUI: 'hide'}); 8 } 9});
1import screenfull from 'screenfull'; 2 3const element = $('#target')[0]; // Get DOM element from jQuery collection 4 5$('#button').on('click', () => { 6 if (screenfull.isEnabled) { 7 screenfull.request(element); 8 } 9});
1import screenfull from 'screenfull'; 2 3$('img').on('click', event => { 4 if (screenfull.isEnabled) { 5 screenfull.toggle(event.target); 6 } 7});
1import screenfull from 'screenfull'; 2 3if (screenfull.isEnabled) { 4 screenfull.on('change', () => { 5 console.log('Am I fullscreen?', screenfull.isFullscreen ? 'Yes' : 'No'); 6 }); 7}
Remove listeners with:
1import screenfull from 'screenfull'; 2 3screenfull.off('change', callback);
1import screenfull from 'screenfull'; 2 3if (screenfull.isEnabled) { 4 screenfull.on('error', event => { 5 console.error('Failed to enable fullscreen', event); 6 }); 7}
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>
1import {Directive, HostListener} from '@angular/core'; 2import screenfull from 'screenfull'; 3 4@Directive({ 5 selector: '[toggleFullscreen]' 6}) 7export class ToggleFullscreenDirective { 8 @HostListener('click') onClick() { 9 if (screenfull.isEnabled) { 10 screenfull.toggle(); 11 } 12 } 13}
1<button toggleFullscreen>Toggle fullscreen<button>
Make an element fullscreen.
Accepts a DOM element and FullscreenOptions
.
The default element is <html>
. If called with another element than the currently active, it will switch to that if it's a descendant.
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.
Returns a promise that resolves after the element enters fullscreen.
Brings you out of fullscreen.
Returns a promise that resolves after the element exits fullscreen.
Requests fullscreen if not active, otherwise exits.
Accepts a DOM element and FullscreenOptions
.
Returns a promise that resolves after the element enters/exits fullscreen.
Events: 'change' | 'error'
Add a listener for when the browser switches in and out of fullscreen or when there is an error.
Remove a previously registered event listener.
Alias for .on('change', function)
Alias for .on('error', function)
Returns a boolean whether fullscreen is active.
Returns the element currently in fullscreen, otherwise undefined
.
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
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.
1import screenfull from 'screenfull'; 2 3document.querySelector('#new-page-button').addEventListener(() => { 4 const iframe = document.createElement('iframe') 5 6 iframe.setAttribute('id', 'external-iframe'); 7 iframe.setAttribute('src', 'https://new-page-website.com'); 8 iframe.setAttribute('frameborder', 'no'); 9 iframe.style.position = 'absolute'; 10 iframe.style.top = '0'; 11 iframe.style.right = '0'; 12 iframe.style.bottom = '0'; 13 iframe.style.left = '0'; 14 iframe.style.width = '100%'; 15 iframe.style.height = '100%'; 16 17 document.body.prepend(iframe); 18 document.body.style.overflow = 'hidden'; 19});
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-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