Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
browser-sync-reuse-tab
Advanced tools
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 :)
1.0.1
Update reference to BrowserSync utils module
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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.