I want to use node js redirect to the url and display the url in a new browser, can that be happening?
The easiest way to do this cross browser is to use the "open" npm module This module allows you to open a new browser window and designate a url to go to
npm install open --save
then in your request when you want to open the new browser and load the url simply call
open( 'http://urltodirect.to', function (err) {
if ( err ) throw err;
});
That will open a new browser window and send the tab to http://urltodirect.to
Hope this helps!
Node Js is a server side technology which can redirect the browsers request to a new location but cannot instructed the browser to open a new window.
You need to use client side javascript to ask the browser to open another window see here:
http://www.w3schools.com/jsref/met_win_open.asp
or use target="_blank" within the link itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With