Is there a such way to capture the loaded page screen of user browser, using my node app.
For Example if user visits the profile page, and i get the screenshot of that user loaded page.
I have tried to do so but end up getting the screenshot of my own screen.
Here is my Code:
var http = require("http")
var fs = require("fs")
var screenshot = require('desktop-screenshot');
function onRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'})
fs.readFile('./profile.html', null, function(err, data) {
if (err) {
res.writeHead(404)
res.write('File not found')
} else{
res.write(data)
screenshot("screenshot.png", function(error, complete) {
if(error)
console.log("Screenshot failed", error);
else
console.log("Screenshot succeeded");
});
}
res.end()
})
}
http.createServer(onRequest).listen(3000)
P.S: I want it to be done from the server side only.