I have this pug page and I need to open the link to a new window. The link is dynamic because it is populated from the backend and when I click the link, I want to open it in a new tab.
How do I do it ?
layout.pug
a(href='/goto/?url='+url)
main.js
app.get('/goto/?url=:url', (req, res) => {
var new_tab_url = req.params.url;
window.open(new_tab_url, '_blank').focus();
});
I need to pass the URL from layout.pug to main.js to open a new tab. But I keep getting error
Cannot GET /goto/
Or perhaps , is there other simpler way ? Thank you