Mithun Sreedharan
Mithun Sreedharan

Reputation: 51274

# character in URL and Scroll to top of the screen on page load

When I refresh a page, browsers retain the scroll position of the page if there is a # in the URL, How to over ride this behavior and scroll to the top of the screen without using JavaScript.

My URL is like http://example.com/#

Update By default the URL is http://example.com/ and the # character is added to the URL upon clicking some part of the page.

Upvotes: 1

Views: 441

Answers (2)

Otar
Otar

Reputation: 2591

Anyway you have a # symbol either in form action or in link href.

Replace # with javascript:; in links.

Replace # with index.php or leave blank (<form action=""...) in forms.

Upvotes: 0

tdammers
tdammers

Reputation: 20721

In case you have a <form action="#" ...> somewhere, that's your culprit. Change it to <form action="" ...>.

Upvotes: 1

Related Questions