I am looking to add a button to a page that will refresh the page when pressed (essentially, the CTRL+R function). Can this be accomplished using Corvid?
import wixLocation from 'wix-location';
...
$w("#myButton").onClick( (event) => {
wixLocation.to(wixLocation.url); // refresh current page
} );
I’ve added the following to the page code with no success
import wixLocation from ‘wix-location’;
$w(“#button109”).onClick( (event) => {
wixLocation.to(wixLocation.url); // refresh current page
} );
There are no errors (i.e., red dots) displaying on any line.
@brainstorrrm , do you see anything wrong with the way I’ve adapted it or does the refresh capability just not exist thru Corvid?
You need to add at least your page onReady to that code, hence why brainstorrrm adding the …
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#myButton").onClick( (event) => {
wixLocation.to(wixLocation.url); // refresh current page
} );
Thank you both! This was very helpful.
How did you managed to make it work ? I’ve tried that code, but doesn’t work
Does not work for me either.
@ann62042 Please add your own issue into a new post instead of bumping up an old post. Explain what you are trying to do, what works, and what doesn’t. Also, add any code in a code block as stated in the Forum Guidelines .
This is an old post and is being closed.