node-iframe
Advanced tools
Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "node-iframe", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "create a iframe on your server to bypass CORS issues. ( reverse engineer security issues )", | ||
@@ -5,0 +5,0 @@ "main": "dist/iframe.js", |
@@ -23,4 +23,4 @@ # node-iframe | ||
url: req.query.url, | ||
baseHref: req.query.baseHref, // optional determine how to control link redirects, | ||
config: JSON.parse(req.query.config), // parse config if sent as query, | ||
baseHref: req.query.baseHref, // optional: determine how to control link redirects, | ||
config: JSON.parse(req.query.config), // optional: determine element cors or inlining per route | ||
}) | ||
@@ -36,7 +36,16 @@ ); | ||
You can even fetch the iframe directly by importing fetchFrame on the client or server. | ||
You can even fetch the iframe directly by importing `fetchFrame` on the client or server. | ||
```typescript | ||
const { fetchFrame } = require("node-iframe"); | ||
async function fetchIframe() { | ||
return await fetchFrame({ url: "https://www.etsy.com" }); | ||
} | ||
``` | ||
Configure how to handle resources for all request can be controlled top level or scoped. | ||
```typescript | ||
const { | ||
fetchFrame, | ||
configureResourceControl, | ||
@@ -47,3 +56,3 @@ configureCacheControl, | ||
// optional: configure if element should be inlined, cors, etc | ||
// optional: configure if element should be inlined, cors, etc, this combines with the `config` param | ||
configureResourceControl({ | ||
@@ -56,10 +65,5 @@ inline: { script: true, link: false }, | ||
configureCacheControl({ stdTTL: 0, checkperiod: 600, disabled: false }); | ||
// optional: configure error-pages - check src/templates for more info | ||
// 0: error, 1: not-found, 2: all templates - check src/templates/config for options | ||
configureTemplates("<div>No Fish found</div>", 1); | ||
async function fetchIframe() { | ||
return await fetchFrame({ url: "https://www.etsy.com" }); | ||
} | ||
``` | ||
@@ -66,0 +70,0 @@ |
41756
72