wixLocation.to(url) strange behaviour

Hi,

I have a text element that has the value of a valid url. The intention is to allow user clicking on it and be directed to an external website (no new tab created in the browser. Existing tab should be loaded with the external website).

However, the current behaviour is that, a new tab is created (it is loading with the external website). In addition, existing tab is also loaded with the external website.

I have coded a function,
txtField_click(event, $w) {
let url = $w(“#txtField”).text ;
if(url != ‘-’ )
wixLocation.to(url); //lets assumed url is https://www.google.com.sg
}

Does anyone know how to prevent the new tab from spawning?

Hello!
Are you sure that’s only way you try to open a link? I mean strict links in general links tab…
Anyway i can’t reproduce it without your site

Can you please provide a link to it so i can check?

Hi,

This is a test website that I use to test the code.

https://cvenchong.wixsite.com/mysite-1

Steps to reproduce the problem (using my site):

  1. in the text box, key in “ste” (without quote)
  2. click “go!” button and perform a filter (this should change the text beside the table, and one of the text should show “http://www.google.com”)
  3. click on it

My actual result: after clicking on it, it spawns a new tab together with existing tab being directed to Google.

My expected result: no new tab. Only existing tab being directed to Google.

Any suggestion?

Hi,

Any help/pointer ?

thank you.

Any wix support seeing this ?

Hi!

I actually can’t reproduce your issue. Look here
https://www.screencast.com/t/RSg0BtoGrC

I see only one tab and it’s current

Can you please take a screen recording of what you see?
can be done for example using screencast . Simply recreate the issue while recording the steps and add the screencast.com URL to your response so we can have a look.

Hi

The result you had is due to that i tried linking the textbox using the link in the UI settings.

I have made it back to trigger the following function upon clicking the text
export function text13_click(event, $w) {
let url = $w(“#text13”).text ;
if(url != ‘-’ )
wixLocation.to(url); //lets assumed url is https://www.google.com.sg
}

You can try again the same testing or view the view this video (Jan 16 2018 7_32 PM.webm)

Thank you.

Regards,
Steven

Hi there,

Any update?

Hi Steven,
We are inspecting this issue. it might take awhile. Try to replace the text element to button element as a temporary solution.
Let me know how goes.
Roi

I am also having issues with this. Why would something as simple as loading a URL ‘take a while’?

Please, this needs to be resolved ASAP. At the moment we have clients filling their browsers with unneeded tabs.

Thanks.