Lightbox-button refreshes all website

I have a button inside a lightbox and I want that when clicked, the button will refresh the website (or just the home page).
I couldn’t find a way to do it. Can anyone help?
Thanks!

You can use this code in the lightbox:

import wixLocation from 'wix-location';//This line must be at the top of the code
$w.onReady(function () {
  $w("#Button1").onClick( (event) => {
    wixLocation.to(wixLocation.url);
    })
})

I tried it now, unfortunately it didn’t work ):

@dankeinandk so you probably did something wrong.

  1. Make sure the property name of your button fits to the button name in the code.
  2. If the button is connected to a link through the editor - remove the link.
    Note: it works only on a published site, not on the editor preview.

@jonatandor35 Problem solved. My problem was that the button was connected to a link through the editor…
THANKS!

You’re welcome.