浏览器在Localhost中加载时自动滚动到页面底部

时间:2022-09-03 20:16:04

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.

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

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.

1)我让我的同事从TFS获取我的版本并运行它,该项目在他的机器上运行良好。

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

2)我重新发布了我的版本并上传到主机,它在主机上运行良好。

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

3)我评论了所有css和js文件,重置了Chrome缓存并再次尝试,没有运气!

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

4)我下载并安装了Mozilla Firefox,问题依然存在。

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

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

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

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

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

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

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

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

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.

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

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

10)我还尝试在Chrome设置中禁用并启用Scroll-Anchoring,但没有任何帮助。

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?!

我很困惑,如果浏览器出现问题,为什么它在Host上工作得很好而且只是LocalHost的问题?为什么FF和Chrome都有同样的问题? IIS是否可能导致此类问题?!

Any Help would be appreciated.

任何帮助,将不胜感激。

4 个解决方案

#1


6  

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.

我刚刚拥有这个,在我的情况下肯定是浏览器链接。要禁用此功能,可以将此设置添加到web.config中。

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

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

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

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

#2


2  

I've experienced this problem too and it began for me yesterday. Same symptoms - happens locally but not if published.

我也经历过这个问题,昨天我就开始了。相同的症状 - 发生在本地但不发布。

A windows update was implemented yesterday - Update for Windows 7 for x64-based systems (KB2952664). I'm wondering if they are linked.

昨天实施了Windows更新 - 基于x64的系统的Windows 7更新(KB2952664)。我想知道他们是否有联系。

Disabling browser link works for me also

禁用浏览器链接也适用于我

#3


1  

This was caused by a recent update to the Web Accessibility Checker extension. I've just released version 1.4.47 with a fix

这是由最近更新Web Accessibility Checker扩展引起的。我刚刚发布了修复版本1.4.47

#4


0  

Browser behavior (issue):

Browser scrolls to the bottom of the page automatically on load.

浏览器在加载时自动滚动到页面底部。


Problem:

Web Essentials is somehow causing a bug in Browser Link.

Web Essentials以某种方式导致浏览器链接中的错误。


Temporal Solution (no changes to web.config):

1) Disable Browser Link > Uncheck the following checkbox:

1)禁用浏览器链接>取消选中以下复选框:

浏览器在Localhost中加载时自动滚动到页面底部

OR

2) Disable Web Essentials Extension.

2)禁用Web Essentials Extension。

Further Details:

Apparently the problem resides when they use Element.scrollIntoView() along this lines in browserLink.js:

显然,当他们在browserLink.js中沿着这一行使用Element.scrollIntoView()时,问题就出现了:

u.getBackgroundColor = function(a) {
  var b = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [],
    e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  e !== !0 && a.scrollIntoView();
  var f = [],
    g = u.getBackgroundStack(a);
  return (g || []).some(function(e) {
      var g = window.getComputedStyle(e),
        h = d(e, g);
      return a !== e && !v.visuallyContains(a, e) && 0 !== h.alpha || c(e, g) ? (f = null,
        b.push(e), !0) : 0 !== h.alpha && (b.push(e),
        f.push(h),
        1 === h.alpha)
    }),
    null !== f && null !== g ? (f.push(new u.Color(255, 255, 255, 1)),
      f.reduce(u.flattenColors)) : null
}

#1


6  

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.

我刚刚拥有这个,在我的情况下肯定是浏览器链接。要禁用此功能,可以将此设置添加到web.config中。

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

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

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

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

#2


2  

I've experienced this problem too and it began for me yesterday. Same symptoms - happens locally but not if published.

我也经历过这个问题,昨天我就开始了。相同的症状 - 发生在本地但不发布。

A windows update was implemented yesterday - Update for Windows 7 for x64-based systems (KB2952664). I'm wondering if they are linked.

昨天实施了Windows更新 - 基于x64的系统的Windows 7更新(KB2952664)。我想知道他们是否有联系。

Disabling browser link works for me also

禁用浏览器链接也适用于我

#3


1  

This was caused by a recent update to the Web Accessibility Checker extension. I've just released version 1.4.47 with a fix

这是由最近更新Web Accessibility Checker扩展引起的。我刚刚发布了修复版本1.4.47

#4


0  

Browser behavior (issue):

Browser scrolls to the bottom of the page automatically on load.

浏览器在加载时自动滚动到页面底部。


Problem:

Web Essentials is somehow causing a bug in Browser Link.

Web Essentials以某种方式导致浏览器链接中的错误。


Temporal Solution (no changes to web.config):

1) Disable Browser Link > Uncheck the following checkbox:

1)禁用浏览器链接>取消选中以下复选框:

浏览器在Localhost中加载时自动滚动到页面底部

OR

2) Disable Web Essentials Extension.

2)禁用Web Essentials Extension。

Further Details:

Apparently the problem resides when they use Element.scrollIntoView() along this lines in browserLink.js:

显然,当他们在browserLink.js中沿着这一行使用Element.scrollIntoView()时,问题就出现了:

u.getBackgroundColor = function(a) {
  var b = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [],
    e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
  e !== !0 && a.scrollIntoView();
  var f = [],
    g = u.getBackgroundStack(a);
  return (g || []).some(function(e) {
      var g = window.getComputedStyle(e),
        h = d(e, g);
      return a !== e && !v.visuallyContains(a, e) && 0 !== h.alpha || c(e, g) ? (f = null,
        b.push(e), !0) : 0 !== h.alpha && (b.push(e),
        f.push(h),
        1 === h.alpha)
    }),
    null !== f && null !== g ? (f.push(new u.Color(255, 255, 255, 1)),
      f.reduce(u.flattenColors)) : null
}