Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
chrome-ext-screen-capture
Advanced tools
Capture screen from a chrome extension
In your manifest.json
file, include the following:
"permissions": ["tabs", "<all_urls>"],
"background": {
"scripts": ["background.js"]
}
In your background page, put the following:
require('chrome-ext-screen-capture').backgroundPage()
In your content script, the following will return an img url:
var cesc = require('chrome-ext-screen-capture')
cesc.takeScreenshot(function (canvas) {
/* You can use either a getBoundingClientRect() function or any individual jQuery object */
var selection = document.getSelection().getRangeAt(0).getBoundingClientRect()
var imgURL = cesc.renderPreview(selection, canvas, {padding: 20}).toDataURL('image/png')
console.log('Check this out', imgURL)
})
Much of this code was originally sourced from Louis Li and his post.
FAQs
Capture screen from within a Chrome extension
We found that chrome-ext-screen-capture demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.