Page not loading through wixLocationFrontend.to

Question:
I am using wixLocationFrontend.to function to load a site page on trigger of a certain event. The function is executing but the page is not loading. I have already verified the link, it works well. Am I missing something?

Product:
Wix Editor

What are you trying to achieve:
On trigger of a specific event eg. button click, I want to navigate the user to another site page.

What have you already tried:
I have tested the link where I want the user to be directed.
Argument that is being passed, I have verified it is correct.

Code snippet:

import wixLocationFrontend from ‘wix-location-frontend’;
//event triggered through a button
export function mobileButton4_click(event) {

wixLocationFrontend.to(“/about-me”);
//Even tried with complete URL, still this did not load the page.
}

You should share your code bro, otherwise it’s hard to help.

I have edited my post and also added the code. thanks for your help

Okay, what do you mean “the function is triggering but page not loading” — does it go to the page but it’s a blank page?

Or how do you know the function is triggering

1 Like

I used a console.log statement to check the url before calling wixLocationFrontend. This confirmed that the button click triggered this event.
However, I’m not sure what happens after wixLocationFrontend is executed. The page does not load as expected. It stays on the same page that initiated the button event.

Maybe you could share your button’s onClick function?

Button click event function is present in my initial post. Thanks

import wixLocationFrontend from ‘wix-location-frontend’;

$w.onReady(()=>{console.log('page is ready...');
    $w('#mobileButton4').onClick((e)>={console.log(e.target.id+'-clicked');
        wixLocationFrontend.to('https://www.google.com');
    });
});