I have a dynamically generated web page with a link that a user can click to set a cookie.
The javascipt that sets the cookie uses the following to refresh the page.
window.location = window.location;
I would like to reload the page to an anchor (#chart). As the page is dynamically generated I don't know the exact URL.
I've tried various methods e.g. below, but with no success.
window.location = window.location.+"#chart";
P.S. I know I can replace
window.location = window.location; with window.location.reload();