I wish to jump to the selected hash whenever my URL contains a #
.
The #
are dynamically created and inserted into header($location);
. Afterwards the new URL loads like this: www.example.com?p=1#key-1
, however it wont go to the selected #
on the page.
How can I do this?
I looked into javascript window.location.hash
, however I couldn't figure out how to use it properly.
UPDATE:
The # in the url works when I manually type #sek-31
into the adress bar. However, when I reload the same URL, I get thrown back to the top of the page.
UPDATE THREE:
Its working in the following browsers:
- Windows version of Safari
- Firefox
- Edge