Open Dynamic Page on blank page

Hi,
Is it possible to open a Dynamic Page on a new page of the same browser?
And how?

Thanks :wink:

put some text on your home page

click edit text

click link

select the dynamic page that you want the link to open

select open in new window

done

Thank you Mike, you’re very kind :slight_smile:

ok but the problem is that the dynamic page is not known, it is variable.
I have to do it with javascript but I dont know how to do it.
The “winlocation.to()” function does not have the target as a parameter.

Thanks a lot

Hi,
Unfortunately wixLocation.to() function does not have target as a parameter :frowning:
feel free to post a feature request here .

@claudio-d-ambrosio

What you can do is place a repeater on your main page and connect it to your dataset.

Set up your dynamic page so that it’s URL is based on the “_id” field in your collection.

The below code will redirect the user to relevant dynamic page when they click on the repeater…

$w(‘#repeaterContainer’).onClick((event) => {
$w(“#dataset1”).onReady(() => {

//get ID for repeater item when clicked

let $item = $w.at(event.context);
let clickedRepeaterItem = $item(“#dataset1”).getCurrentItem();

let itemID = ${clickedRepeaterItem._id}

        console.log(itemID); 

//re-direct to dynamic page with URL + repeater item ID. Change the static part of the URL as necessary.

        wixLocation.to('https://YourWebsite.com/dynamicpage/' + itemID); 



    }); 

})

Hi Mike,
I tried something similar to your suggestion.using the API LinkableMixin but it did not work well.

The first click on the button did not work then yes, but always opened the dynamic page selected before and not the current one

export function button28_click(event) {
 
 $w("#button28").link =   
 "https://cdambrox.wixsite.com/sbet/CALENDARI/"+$w("#text128").text+'/'+$w("#text129").text+'/'+$w("#text130").text;  
 $w("#button28").target = "_blank";
}

It’s ok if I also manage the event mouseIn() of the button28

export function button28_click(event) {
 
$w("#button28").link = "https://cdambrox.wixsite.com/sbet/CALENDARI/"+$w("#text128").text+'/'+$w("#text129").text+'/'+$w("#text130").text;  
    $w("#button28").target = "_blank";
}

export function button28_mouseIn(event) {
$w("#button28").link = "https://cdambrox.wixsite.com/sbet/CALENDARI/"+$w("#text128").text+'/'+$w("#text129").text+'/'+$w("#text130").text;  
    $w("#button28").target = "_blank";

}

Don’t ask me how, but it works :slight_smile:

On the mobile instead it still does not works

Thanks and excuse for my bad english
Claudio