Browser-sync: object doesn't support property or method 'scrollTo' on IE11

Created on 29 Nov 2018  路  1Comment  路  Source: BrowserSync/browser-sync

Issue details

When navigating around in an React 16.6.3 web application I suddenly get this error message when pressing a button in IE11 only:

screenshot 2018-11-29 at 13 10 32

Steps to reproduce/test case

Have been unable to provide a minimal use case, sorry.

Please specify which version of Browsersync, node and npm you're running

  • Browsersync 2.26.3
  • browser-sync-webpack-plugin 2.2.2
  • Node 10.13.0
  • Npm 6.4.1

Affected platforms

  • [ ] linux
  • [X] windows
  • [ ] OS X
  • [ ] freebsd
  • [ ] solaris
  • [ ] other _(please specify which)_

Browsersync use-case

  • [ ] API
  • [ ] Gulp
  • [ ] Grunt
  • [ ] CLI
  • [X] Webpack

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

In my webpack config:
`` new BrowserSyncPlugin({ host: process.env.IPADDRESS, port: Number(process.env.PORT) + 1, proxy: 'http://' + process.env.IPADDRESS + ':' + process.env.PORT, minify: false, proxyOptions: { // https://github.com/Browsersync/browser-sync/issues/430 xfwd: true, // Forward all headers thru the proxy changeOrigin: false, // Keep the original origin }, open: false, // Open a browser cors: true, // Set the CORS headers to allow CORS }),

Most helpful comment

Yup, I had the same issue preventing BrowserSync working in Edge.

Edge doesn't implement HTMLElement.prototype.scrollTo: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15534521/

And in set-scroll.ts, Browser-Sync calls this method.

I opened a PR to fix this.

I setup a workaround for my need (hack)聽:

browserSync.use({
    plugin() {},
    hooks: {
        'client:js': 'if (!HTMLElement.prototype.scrollTo) { HTMLElement.prototype.scrollTo = function (left, top) {this.scrollTop = top; this.scrollLeft = left; } }'
    }
});

>All comments

Yup, I had the same issue preventing BrowserSync working in Edge.

Edge doesn't implement HTMLElement.prototype.scrollTo: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15534521/

And in set-scroll.ts, Browser-Sync calls this method.

I opened a PR to fix this.

I setup a workaround for my need (hack)聽:

browserSync.use({
    plugin() {},
    hooks: {
        'client:js': 'if (!HTMLElement.prototype.scrollTo) { HTMLElement.prototype.scrollTo = function (left, top) {this.scrollTop = top; this.scrollLeft = left; } }'
    }
});
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hurtak picture Hurtak  路  3Comments

demisx picture demisx  路  4Comments

ericmorand picture ericmorand  路  3Comments

jitendravyas picture jitendravyas  路  4Comments

pensierinmusica picture pensierinmusica  路  4Comments