Open dynamic pages in new tabs

Hi, I have a dataset that contains details of job openings. I use a dropdown to filter job openings and a repeater to show summaries of job openings and whoever wish to read more can click “view button” and they will be directed to the relevant dynamic page.
I want this dynamic page to be opened in a new tab.
Currently it opens in the same tab and the users filtered results will loose once they hit the back button from a dynamic page.
Alternatively I used a dynamic lightbox, but my content is huge and lightbox extended further down than what the screen covers.

Question: Is there a way to open dynamic pages in new tabs

Hello Thilini,

You might have to use a little bit more the search-function of this forum. :grin:
Just found somewhere in this forum, within 5min of search…

import wixLocation from 'wix-location';

let BaseUrl = wixLocation.baseUrl;
let myLink = "/about-me"

$w("#myElement").link = BaseUrl + myLink;
$w("#myElement").target = "_blank";

Hey, thanks for your response.
I searched a lot but couldn’t find a working code and this one also doesn’t work :disappointed_relieved: I think the other best option is trying to work on saving filtered results in local storage but that coding is somewhat difficult for me to understand as i’m just a beginner.

@thiliniprasangika11
This might help you…
https://www.wix.com/corvid/reference/wix-storage/storage/introduction

Local: Data in local storage never expires, even if the site visitor closes your page. When the visitor reopens the page later, the data can still be retrieved. You can store up to 50kb of data in local storage.

How to save values into Wix-Storage?..

$w.onReady( function () {
    $w("#yourButtonIDhere").onClick( () => {
 let key1 = "YourKeyWordForAspecialValue"
 let vlaue1 = "HereYourValueToStore"
 
 let key2 = "YourSecondKeyWordForAspecialValue"
 let vlaue2 = "HereYourSecondValueToStore"
 //and so on .........
 
        local.setItem("key1", "value1");
        local.setItem("key2", "value2");
 //and so on .........
    })
})

@russian-dima
Hey, thank you very much, this is really useful for me. I’m currently working on this and hope I’ll be able to do it this time :blush:

@thiliniprasangika11
Could you manage your issue?