Vue Browser Update Wrapper

1.2.0 · active · verified Sun Apr 19

`vue-browserupdate` is a Vue.js wrapper for the popular `browser-update.org` JavaScript library, designed to streamline the integration of browser version checking and update prompting into Vue applications. It provides a straightforward API to initialize the underlying `browser-update` script and exposes its core events—`onshow`, `onclick`, and `onclose`—as Vue-compatible functions. The current stable version, 1.2.0, indicates a mature wrapper for Vue 2 applications. Its release cadence typically follows updates to the core `browser-update` library or significant changes within the Vue.js ecosystem. The package's primary differentiator is its simplicity in encapsulating the browser update notification logic within a standard Vue plugin pattern, minimizing boilerplate for developers.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install `vue-browserupdate` as a Vue plugin, pass custom options to the underlying `browser-update` library, enable test mode, and attach event listeners to the browser update prompt.

import Vue from 'vue';
import VueBrowserUpdate from 'vue-browserupdate';

// Install the plugin with custom options
Vue.use(VueBrowserUpdate, {
  options: {
    container: document.body,
    required: { e: -2, f: -2, o: -2, s: -2, c: -2 }, // Example: Require latest 2 versions
    text: 'Your browser is outdated. Please update to improve your experience and security.',
    // Full options: http://browser-update.org/customize.html
  },
  test: true, // Enable test mode to always show the prompt
});

// Attach event listeners (optional)
Vue.browserUpdate.onshow(() => {
  console.log('The browser update modal is visible.');
});

Vue.browserUpdate.onclick(() => {
  console.log('The update link was clicked.');
});

Vue.browserUpdate.onclose(() => {
  console.log('The update modal was closed.');
});

// Basic Vue app setup
new Vue({
  el: '#app',
  template: '<div><h1>My App</h1><p>Browser update prompt will show if conditions met.</p></div>'
});

view raw JSON →