浏览器在本地主机上加载时自动滚动到页面的底部 [英] Browser scrolls to the bottom of the page automatically on load in Localhost

查看:382
本文介绍了浏览器在本地主机上加载时自动滚动到页面的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我见过的最奇怪的问题。
我正在使用Visual Studio Enterprise 2015版本14.0.25425.01更新3和开发.NET Web应用程序。
今天当我推出一个网页应用程序,完成页面加载后,突然滚动到底部。
首先,我认为这可能是一个JavaScript函数或东西,但事实并非如此。
它在托管服务器上没有问题,但在本地主机上存在这个问题。



我尝试的诊断步骤如下, 1)我问我的同事从TFS得到我的版本,并运行它,该项目在他的机器上没有问题很好。

$ b $
$ b b
2)我重新发布了我的版本,并上传到主机,它在主机上效果很好。


$ b <3>我评论了所有的css和js文件,重置Chrome缓存并重试,没有运气!
$ b $ 4)我下载并安装了Mozilla Firefox,问题还没有解决。



5)我重新启动IIS Express并重新启动我的笔记本电脑,是没有帮助的。

6)我打开另一个解决方案,并运行它,奇怪的是问题在其他项目上也存在!!!!



7)我尝试更改项目端口,并没有帮助。


$ b $ 8)我试图创建一个新的页面,没有MasterPage,它没有问题。



9)当我添加一个Button或者Anchor元素到页面时,浏览器向下滚动到那个元素,但是没有任何活动元素(比如锚点或者按钮)的页面没有问题。



10)我也尝试禁用和启用滚动锚定在Chrome设置,但没有帮助。



我很困惑,如果浏览器导致问题,为什么它在主机上工作很好,只是与LocalHost的问题?为什么FF和Chrome都有同样的问题?是否有可能是IIS导致这样的问题?



任何帮助将不胜感激。

解决方案

我刚刚有这个,在我的情况下,这绝对是Browser Link。要禁用此功能,您可以将此设置添加到您的web.config。

 < add key =vs:EnableBrowserLinkvalue =false/> 

正如@Salman所指出的,这个应该存在于appSettings部分:

 < appSettings> 
< add key =vs:EnableBrowserLinkvalue =false/>
< / appSettings>


This is the most strange problem I've ever seen. I'm using Visual Studio Enterprise 2015 Version 14.0.25425.01 Update 3 and developing .NET web applications. Today when I lunched one of web applications, after page loads completely, suddenly it scrolled down to the bottom. First I thought it may be a javascript function or something, but it wasn't. It works without problem on hosted server but in local host this problem exists.

The diagnosis steps I've tried are as below and nothing else comes to my mind.

1) I asked my colleague to get my version from TFS and run it, the project works great without problem on his machine.

2) I republished my version and uploaded to Host, it works great on the Host.

3) I commented all css and js files, reset Chrome cache and tried again, no luck!

4) I downloaded and installed Mozilla Firefox, the problem exists yet.

5) I restarted IIS Express and rebooted my laptop, wasn't helpful.

6) I opened another solution and ran it, and strangely the problem exists on other projects too!!!!

7) I tried changing the project port and it didn't help.

8) I tried to create a new page, without MasterPage and it had no problem.

9) When I add a Button or Anchor element to the page, the browser scrolls down to that element but a page without any active element such as anchor or button, has no problem.

10) I also tried to disable and enable Scroll-Anchoring in Chrome settings, but no help.

I'm confused, If the browser causes problem, why it works great on the Host and just problem with LocalHost? And why both FF and Chrome had the same problem? Is it possible that IIS causes such problem?!

Any Help would be appreciated.

解决方案

I've just had this and it is definitely Browser Link in my case. To disable this, you can add this setting to your web.config.

<add key="vs:EnableBrowserLink" value="false" />

As @Salman points out, this should live in the appSettings section:

<appSettings>
    <add key="vs:EnableBrowserLink" value="false" />
</appSettings>

这篇关于浏览器在本地主机上加载时自动滚动到页面的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆