Open a new tab when user clicks on a choice
# 🤝help
This is my code in the execute code card. Tried and it didn't work, not sure if anyone knows if it's my code or is it just not possible? const openNewTab = (url) => { const newTab =, '_blank') newTab.focus() } openNewTab('')
You want to open new tab?
Yes so imagine clicking on a choice card in the bot, then getting linked directly to Apple's website.
There are several ways to achieve the desired behavior: 1. Sending text messages with the links instead of the choices - not as cool but... The user will then click on the desired link and open the website on a new tab if they are talking through the webchat, or in the mobile browser if they are talking through whatsapp or telegram. The conversation can proceed normally or stop. 2. Having the choices that transition to nodes with text messages containing the link (like in the first image) 3. Sending a custom event to your webchat (second image), and then adding the following code to your website:
Copy code
window.botpressWebChat.onEvent(event => {, '_blank');
}, ['TRIGGER'])
Hope that helps!

Hey @wonderful-dusk-90567 this should help you as well!
Number 3 is what I was looking for thanks for helping out 🙂 Do you input that code block just below the chatbot embed code or somewhere else?