Hi guys,
I have a URL field in my database (a URL within my Wix site) and I connected it to a Wix Pro gallery (“Links connect to”).
Now, when I click the item in the gallery, it opens a new tab.
Is there any way to make it open in the same tab?
I’ve found some solutions here for buttons with links, but can it done somehow with galleries too?
Same Problem here with the gallery it always open in a new tab…anyone please…I need to finish my project. I used this code in Repeaters button and it works
$w.onReady( function () {
$w(“#button1”).target = “_self”;
});
I try to used this also in the gallery but it not works…do you have code for the gallery?
Wix apps are proprietary, thus the only control you have over them is what they give you. You could create your own alternative and then you would have the ability to target your current window.
@juancarlosvalverdeso , as a workaround you can set the gallery to “when clicking an item nothing happens” on the editor, and then use wix-location to redirect the user to the link destination onItemClicked:
@jonatandor35 This look like what im looking for but I cant seem to get it to work. When I click on the gallery item I get a TypeError: _wixlocation2.default.to.to is not a function. Any ideas?
@justinsa Also, you should delete everything below what J.D. wrote for you. It’s more than just bad syntax, it may lead you on a path to the bad habit of having more than one onReady function.
@jonatandor35 I still am unable to get the link to open in the same window. Not sure what I am doing wrong? It seems sometimes it works but then reverts to opening in a new window. Is there something else I can do to get this working? Appreciate the help. (First part of the code is trying to address the same window opening, second part is a randomiser for the gallery)
@jonatandor35 Thank-you so so very much for your help. After a couple more hours of trying to get it to work I think i found what was the issue. The links were full web addresses, when I changed those to be just “/pagename” it seems to be opening in the same window fine (before they were “http://mysite.wixsite.com/sitename/pagename”
I am having the same issue. I have a database with dynamic pages and a button to link to a page within the website. I’ve tried all the code the form has suggested and it still opens in a new window! Any help is appreciated.
Thanks,
Simone