
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@medmain/ensure-browser
Advanced tools
ensure-browser
packageA simple script to be included in Medmain web applications, to ensure that the browser is supported.
If the browser is not supported, an error message is displayed and the React application is not rendered.
In index.html
:
<script>
tag to load it from a CDNensureBrowser(browsers)
function to specify the supported browsers.<script
crossorigin
src="https://unpkg.com/@medmain/ensure-browser@0.1.0/dist/browser/ensure-browser.js"
></script>
<script>
window.IS_SUPPORTED_BROWSER = window.ensureBrowser([
{name: 'firefox', version: '10'},
{name: 'chrome', version: '20'}
]);
</script>
Optional: in addition of the name
property, specify a displayName
to customize the way the supported browsers are displayed in the error message.
In src/index.js
, don't render the application if the browser is not supported.
if (window.IS_SUPPORTED_BROWSER === false) {
throw new Error('Your browser is not supported!');
}
(async () => {
let element;
try {
await app.initialize();
element = (
<BaseRoot app={app}>
<Root />
</BaseRoot>
);
} catch (err) {
console.error(err);
element = renderError(err);
}
ReactDOM.render(element, document.getElementById('main'));
})();
The name
property of the supported browsers can be one of the following values:
chrome
chrome mobile
electron
firefox
firefox for ios
ie
microsoft edge
phantomjs
safari
seamonkey
silk
opera mini
opera
This list was extracted from Platform.js v1.3.5 code. All names were converted to lower case.
FAQs
Ensure the current browser is supported
We found that @medmain/ensure-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.