Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Customizable interaction-based link prefetching based largely on InstantcClick.
Start downloading the next page before the user even clicks!
There is between 250ms and 400ms from the time a user starts hovering over a link they fully intend to click and actually clicking it. That's unnecessary latency! Prefetch makes pages load up to 400ms faster by requesting them as soon as the user begins hovering over a link. Awesome, right?
var Prefetch = require('prefetch');
Prefetch.init({containers: ['.primary-nav']});
This example will listen for a mouseover event on any anchor tags within the element with class .primary-nav
. If the anchor is prefetchable, it will be retrieved in the background.
A prefetchable anchor tag must meet the following criteria:
href
attributedownload
attributelocation.href
(with hash removed)There are two ways to blacklist a link:
data-no-prefetch
attribute to anchor tags you want to ignoreexclusions
feature from the .init()
call or the .addExclusions()
callThis is how you initialize Prefetch with any settings you want to pass in. You can call init as many times as you want, but be aware that, each time you do, any arguments you do not pass within config
will take on the default value shown below.
//All options shown with default values
Prefetch.init({
containers: [], //An array of CSS selectors passed as strings--a delegate listener will be attached to these elements
exclusions: [], //An array of partial links passed as strings--if the potential prefetch link contains any of these partial links, it will be ignored
hoverDelay: 50, //The number of miliseconds after which a sustained hover triggers a link prefetch
enableTouch: false, //Whether to prefetch on touchstart and therefore on mobile
waitForMousedown: false //Whether to prefetch on mousedown instead of on hover
});
Allows you to programmatically prefetch fully-qualified URLs outside of user interaction. You can pass either a single URL or an array of URLs. This is useful if you know that a high percentage of your users navigate to a specific page from the current page. You can begin prefetching not only the page to which the user is likely to go, but also the render-blocking assets included on that page.
Allows you to attach additional listeners after the .init()
call is made. This can be useful if you have an app-wide Prefetch config in shared code but want to add page-specific listeners outside of that shared code.
Allows you to add an array of items to the exclusions
argument provided at initialization. You should not make your exclusions list long as iterating over long lists will degrade the performance gain Prefetch introduces.
FAQs
Customizable interaction-based link prefetching.
The npm package prefetch receives a total of 36 weekly downloads. As such, prefetch popularity was classified as not popular.
We found that prefetch 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.