5

I am using express.
I knew there were res.send, res.render and res.redirect methods.

but is there a way to open a new window?

thanks all.

Prophet
  • 32,350
  • 22
  • 54
  • 79
Job Smith
  • 263
  • 1
  • 6
  • 15
  • I don't understand question exactly? http://www.quackit.com/html/codes/html_open_link_in_new_window.cfm? – Alfred Jun 26 '12 at 08:50
  • The answer to [How to use nodejs to open default browser and navigate to a specific URL][1] might answer your question as well. [1]: http://stackoverflow.com/questions/8500326/how-to-use-nodejs-to-open-default-browser-and-navigate-to-a-specific-url – wang502 Jul 16 '15 at 20:56

2 Answers2

2

ExpressJS is web framework for NodeJS

below functions are used to provide response to incoming request

res.send(), res.render()  res.redirect(), res.json(), res.download()

opening a new window in browser is not part of expressJS

you need to use different npm for Headless browser like Puppeteer

example code :

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({headless: false});
  const page = await browser.newPage();
  await page.goto('https://google.com');

  await browser.close();
})();

Note : headless: false will show you tab open in browser,

Saurabh Mistry
  • 12,833
  • 5
  • 50
  • 71
-4

This would need to happen on the client side via

window.open("link", "_blank")
matt3141
  • 4,303
  • 1
  • 19
  • 24