I have some buttons on my site that point to an external website. The thing is that the buttons, at least in desktop, won’t open if set to open the page in the same tab.
They will work if you set them to open an another tab, but I don’t want it to open so many tabs.
I found this, but the code references to one button, and in my case there will be many buttons as said.
Any ideas?
Hey! This is a common issue when linking to external websites in the same tab — especially on desktop. Sometimes the buttons just won’t work unless you set them to open in a new tab.
Here’s a fix that works:
You can use a small piece of code to make all your buttons open external links in the same tab, and it’ll work even if you have many buttons.
Give each button a unique ID in the Wix Editor (like button1, button2, etc.).
Then paste this code in the Site Code (not inside any specific page):
That’s it! This tells each button what link to open, and it works in the same tab just like you want, no more opening tons of new tabs.
Let me know if you want help setting it up!
Tested it out, it didn’t work.
do you stilll need help setting it up