New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dynamic-resource-hints

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynamic-resource-hints - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

16

index.js
var makeHint = function makeHint(href, rel, as, crossorigin, type) {
var link = document.createElement("link");
var existingLink = document.querySelector("link[href=\"" + href + "\"]");
if (existingLink) {
if (existingLink.getAttribute(rel)) return;
}
link.setAttribute("rel", rel);

@@ -14,3 +20,3 @@ link.setAttribute("href", href);

var hasBeenPrefetched = [];
var allowedRels = ['preload', 'prefetch', 'prerender', 'subresource', 'prefetch', 'preconnect', 'dns-prefetch'];
var allowedRels = ['preload', 'prerender', 'subresource', 'prefetch', 'preconnect', 'dns-prefetch'];

@@ -40,11 +46,5 @@ function preloadResource(href, rel, as, crossorigin, type) {

if (!hasBeenPrerendered.includes(href)) {
hasBeenPrerendered.push(makeHint(href, rel, as, crossorigin, type));
}
if (!hasBeenPrefetched.includes(href)) {
hasBeenPrefetched.push(makeHint(href, rel, as, crossorigin, type));
}
makeHint(href, rel, as, crossorigin, type);
}
module.exports = preloadResource;
{
"name": "dynamic-resource-hints",
"version": "0.0.6",
"version": "0.0.7",
"description": "Dynamically add preload browser hints at runtime",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc