Is there a way to refresh the page with a script in postfunction or behavior?

Is there a way to refresh the page with a script in postfunction or behavior?
I know how to refresh with JavaScript, but I don’t know how to Groovy. Please let me know if you know.
thanks