wixLocation.to("http://wix.com") not working !

Hi all, I’m facing an issue to navigate to external web address, I have used below code in my lightbox code, everything is working except wixLocation.to statements.
Surprisingly, code statements works if i use local page url or other link patterns. I have already dive in to the previous related solutions advised in this forum but nothing works. please help
export function cgotostore0_click(event) {
// Add your code for this event here:
wixLocation.to(“http://wix.com”)
}
Nothing happens when button element clicked. please please if someone helps.

  1. Can I assume you remembered to import wixLocation?

  2. Check the property panel of cgotostore0 and be sure the click listner is there.

  3. Add console.log(‘something’); to the event handler and see what it logs.

Thanks J.D. for the quick suggestion.
Unfortunately I have already done the advised steps but no luck.

  1. Import Wix location already.

  2. Property panel of cgotostore0 has been setup already and hence when i click export function added in my developer code area. As I said if we use other than external web address like local page etc this button is working fine only with external web address this is not working.

  3. console.log( wixLocation.to( “http://wix.com” ) ) shows undefined, well this shows undefined even if you do console.log(“/home”) but for local page link parameters wix location is working.

Please if someone suggest! More likely to be Wix issue i suspect.

Maybe you tried it in preview mode instead of live site.
Please post your full code.

@jonatandor35 Thanks J.D, You’re actually right , I’m trying in preview mode instead and as you said code I tried code in Live mode which is working fine as expected.
Not sure how code is actually working fine in Live mode but not in preview mode?
Thanks