john-doherty / node-iframe-replacement Goto Github PK
View Code? Open in Web Editor NEWAn alternative to sticking that lovely web app into an <iframe> on a corp website
License: ISC License
An alternative to sticking that lovely web app into an <iframe> on a corp website
License: ISC License
Would something like this be possible with PHP instead of node? I hate relying on iFrames for my apps. :)
Hello,
Thanks you for this code, it is really nice.
I have a header that I want to hide on all the pages of a website for example "https://www.website.com". I can do it with you code for the homepage.
I would like server.js to reroute the links within the app so it still hides the header on "https://www.website.com/about">
Do you think there is a way to do that ? Do you know how I could hide the header on all the pages ?
Regards,
I was trying to setup node-iframe-replacement, but keep getting this error – ‘Unable to retrieve http://www.bbc.co.uk/news’ when i access localhost
The exception says - RequestError: Error: getaddrinfo ENOTFOUND www.bbc.co.uk www.bbc.co.uk:80
Any idea what’s wrong ?
OS Version : MacOS Sierra : Ver 10.12.5
Chrome : Version 49.0.2623.110 (64-bit)
First of all, this is a very nice node iframe replacement. Is it possible to render the particular web page lets say bbc.com inside any element? For instant,
<div or iframe src="parsed.html">
Content for [bbc.com](http://www.bbc.com/http://www.bbc.com/)
</iframe>
So that, the exact need of iframe can be replaced ? Please find the attachment for the details.
The other day I was trying to make an iframe for this link for an affiliate program (http://freebitco.in/?r=9171729&tag=wonderland), and I did a test page (http://wonderlandcoin.com/bitcoin/2.php) and the test uses the Example Domain (example.com) and that works, but when I put in the real URL above, the result is a blank page (http://wonderlandcoin.com/bitcoin/) My question is, did they block the ability for anyone to display their site in an iframe? If so, would your thing help me at all?
C:\Users\ADMIN\myapp\node_modules\node-iframe-replacement\example>node server.js
Server running... Visit http://localhost:8080 in your browser
C:\Users\ADMIN\myapp\node_modules\cheerio\lib\parse.js:55
var oldParent = node.parent || node.root,
^
TypeError: Cannot read property 'parent' of undefined
at Function.exports.update (C:\Users\ADMIN\myapp\node_modules\cheerio\lib\parse.js:55:26)
at module.exports (C:\Users\ADMIN\myapp\node_modules\cheerio\lib\parse.js:17:11)
at Function.exports.load (C:\Users\ADMIN\myapp\node_modules\cheerio\lib\static.js:19:14)
at C:\Users\ADMIN\myapp\node_modules\node-iframe-replacement\lib\node-iframe-replacement.js:37:41
at Immediate. (C:\Users\ADMIN\myapp\node_modules\express-handlebars\lib\utils.js:18:13)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
const express = require('express')
const next = require('next')
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
var iframeReplacement = require('./lib/node-iframe-replacement.js');
app.prepare()
.then(() => {
const server = express()
app.use(iframeReplacement);
server.get('/a', (req, res) => {
return app.render(req, res, '/b', req.query)
})
server.get('/b', (req, res) => {
return app.render(req, res, '/a', req.query)
})
server.get('*', (req, res) => {
return handle(req, res)
})
server.get('/bbc', function(req, res) {
return handle(res.merge('fake-news', {
sourceUrl: 'http://www.bbc.co.uk/news', // external url to fetch
sourcePlaceholder: 'div[data-entityid="container-top-stories#1"]' // css selector to inject our content into
});
}));
server.listen(3000, (err) => {
if (err) throw err
console.log('> Ready on http://localhost:3000')
})
})
A page gets rendered at pages/bbc.js that includes a react component with title BBC.
Any ideas on how to get these two projects integrated?
used git clone into new VS Code project - build succeeded, but failed to run :
"error Failed at the [email protected] start script."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.