Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disconnect a running Browsersync instance?

Tags:

browser-sync

I often would like to compare a new change with the original. To do this, I open two browser tabs of the same page, make a change, then reload one of the tabs to compare. With Browsersync enabled, this becomes impossible because both tabs automatically reload.

How can I disable Browsersync for a particular tab to prevent this from happening? I'm looking for a way to do this from the Javascript console, not having to stop/reload my watcher.

The Browsersync API has a pause() method, but I can't see a way to access this from an actual running Browsersync instance. There is a window.___browserSync___ object accessible, so there must be some way to achieve this.

like image 488
hackel Avatar asked Jan 30 '23 16:01

hackel


1 Answers

The command should be:

 window.___browserSync___.socket.disconnect();

If the ___browserSync___ object isn't available for some reason from the console try doing this in a fresh tab.

like image 112
hugo der hungrige Avatar answered Mar 04 '23 22:03

hugo der hungrige