Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
code42day-load
Advanced tools
Basic script loader.
The simplest and fastest way of loading scripts in modern browser is simply listing them at the end of the body element.
Use load only if for some reason you need to load your scripts dynamically - useful when integrating various 3rd party widgets and snippets (google analytics, disqus, twitter API etc.) on your page.
Install with component(1):
$ component install code42day/load
var load = require('load');
load('//topic.disqus.com/count.js');
Please note that scripts added to the DOM are async
by default (see this article on script
loading) which means that they will start executing as soon as they load in pretty much random
order.
You can force async to false
but some browsers will ignore it.
load('//topic.disqus.com/count.js', false);
load
returns script element - you can register onerror
and onload
callbacks
load('//cdn/script.js').onload = function () {
console.log('my script loaded');
});
and:
load('//cdn/script.js').onerror = function (err) {
console.log('cannot load script', err);
});
If you your callback work with IE use segmentio/script-onload
var load = require('load');
var onload = require('script-onload');
onload(load('//cdn/script.js'), function(err) {
if (err) {
console.log('Cannot load script', err);
} else {
console.log('Script loaded');
}
});
MIT
FAQs
Basic script loader
We found that code42day-load 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.