开发者

# 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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜