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

iframe-injectable

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iframe-injectable - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

21

iframe/iframe.js

@@ -47,3 +47,3 @@ "use strict";

var realFrame = typeof frame === 'number'
? document.getElementsByTagName('iframe')[frame]
? document.getElementsByTagName('iframe').item(frame)
: (typeof frame === 'string'

@@ -148,5 +148,22 @@ ? document.querySelector(frame)

realFrame.addEventListener('error', callback);
}
},
test: function () { return __awaiter(void 0, void 0, void 0, function () {
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
_d.trys.push([0, 2, , 3]);
_a = Boolean;
_b = getDocument;
return [4 /*yield*/, getLoaded(realFrame)];
case 1: return [2 /*return*/, _a.apply(void 0, [_b.apply(void 0, [_d.sent()])])];
case 2:
_c = _d.sent();
return [2 /*return*/, false];
case 3: return [2 /*return*/];
}
});
}); }
};
return injectable;
};

2

package.json
{
"name": "iframe-injectable",
"version": "0.0.1",
"version": "0.1.0",
"description": "Library for iframe style/js/html injection",

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

@@ -19,3 +19,3 @@ # iframe-injectable documentation

// Load iframe
const frame = iframe('#frame')
const frame = iframe('#frame') // Access iframe by query selector (can access it by index of iframe on page (n-th iframe), or by passing HTMLIFrameElement)
.dom(successDiv) // Add div to body

@@ -33,2 +33,3 @@ .dom(successSpan, '[name="success"]') // Add span to element named success

console.log((await frame.body())?.className); // gets iframe <body> tag and reads its classname
console.log(await iframe(1).test()); // Will return false since iframe cannot access document.body of wikipedia iframe
})();

@@ -42,4 +43,8 @@

## Changes since 0.1.0
Can now test CORS accessibility with .test() method, which returns a boolean promise
## Footer
If you discover any bugs, or have ideas about improving this package, do not hesitate to file in an issue or create a pull request.

@@ -44,2 +44,6 @@ export interface InjectableIframe {

error: (callback: (e: ErrorEvent) => void) => void;
/**
* Tests whether or not you can access document body of iframe
*/
test: () => Promise<boolean>;
}
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