I'm using sveltekit goto function to navigate to a page using on:click on a div.
clickHandler: (id: string) => goto(`/app/profile/${id}/settings/general-info`)
How can I specify to open page in a new tab just like using CTRL + Click?
I'm using sveltekit goto function to navigate to a page using on:click on a div.
clickHandler: (id: string) => goto(`/app/profile/${id}/settings/general-info`)
How can I specify to open page in a new tab just like using CTRL + Click?
you can use a regular <a>
element to create a link and specify target="_blank"
to open it in a new tab.
here is an example of the the code.
<a href="https://svelte.dev" target="_blank">Svelte</a>
a live web environment showing that how it works. stackblitz Live Demo
If you want to manage this from a ts/js file and the code is running client side then you can use window.open instead of goto -
window.open(`/app/profile/${id}/settings/general-info`, "_blank");