Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
browser-sync-reuse-tab
Advanced tools
Attempt to reuse an existing tab that was opened by BrowserSync
Attempt to reuse an existing tab that was opened by BrowserSync.
Depending on your configuration, when you start BrowserSync, a tab is opened in your browser pointing to BrowserSync. When you restart BrowserSync another tab is opened in the browser. The more times you restart BrowserSync, the more tabs that will be opened in the browser.
This package gets around this by trying to reuse an existing tab that was already opened by BrowserSync. When you restart BrowserSync, the previously opened tab will be focused and reloaded. The window that the tab is in will also be focused.
At this moment, only Google Chrome on OS X >= 10.10 is supported, see notes below.
npm install --save-dev browser-sync-reuse-tab
var browserSync = require('browser-sync').create()
var browserSyncReuseTab = require('browser-sync-reuse-tab')(browserSync)
browserSync.init({
server: './src',
open: false // do not automatically open browser
}, browserSyncReuseTab)
BrowserSync lets you configure which URL to open when it starts. browser-sync-reuse-tab
needs the open
option that is passed to BrowserSync.init
to be set to false
so that it can attempt to reuse an existing tab that was already opened. You can still tell BrowserSync which URL to open when it starts by passing the name of the URL to browser-sync-reuse-tab
:
var browserSync = require('browser-sync').create()
var browserSyncReuseTab = require('browser-sync-reuse-tab')(browserSync, 'external') // open the external URL when browserSync starts
browserSync.init({
server: './src',
open: false // do not automatically open browser
}, browserSyncReuseTab)
See the BrowserSync documentation for the names of the URL's. By default, if no URL is specified the local
URL will be used.
Only Google Chrome at the moment.
Only OS X >= 10.10 at the moment.
This package use's JavaScript to control the browsers behaviour. Support for using JavaScript for Automation was added in OS X 10.10. Older versions of OS X could be supported if i had used AppleScript instead. But AppleScript is gross.
This package scratches an itch for my own workflow. I predominantly use Google Chrome on OS X for development, so yeah its a bit biased. I would love to add support for other browsers and operating systems. If you fancy lending a hand, pull requests are welcome :)
FAQs
Attempt to reuse an existing tab that was opened by BrowserSync
We found that browser-sync-reuse-tab demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.