not-for-ie

0.9.2 • Public • Published

not-for-ie

npm version npm downloads License
Build Status Code Climate js-myterminal-style Coverage Status
NPM

A mini-library to declare that your web application is not designed to run in Internet Explorer

Features

  • Appends a specified CSS class to HTML body on activation
  • Provides a method to detect IE

How to Use

Directly from a web page

One can use not-for-ie directly from a web-page by attaching the not-for-ie.js and not-for-ie.css to the DOM.

<!-- Attaching the not-for-ie script -->
<script type="text/javascript" src="path/to/library/not-for-ie.js"></script>

<!-- Usage -->
<script type="text/javascript">
    notForIe.activate('ie');
</script>

With Webpack, Browserify or RequireJS

Install not-for-ie from NPM

npm install not-for-ie --save-dev

Consume as an ES6 module

import * as notForIe from 'not-for-ie';

or

import { isIe } from 'not-for-ie';

Consume as a CommonJS module

var notForIe = require('not-for-ie');

Consume as an AMD

require(['not-for-ie'], function (notForIe) {
    // Consume notForIe
}

Note: You may have to use Babel for ES6 transpilation.

Methods

activate

Appends the specified CSS class to the HTML body element.

notForIe.activate('ie');

isIe

Determines whether the application is known to be running within Internet Explorer.

if (notForIe.isIe()) {
    // Running within IE
}

Demo

You can view a demo here.

To-do

  • Write unit-tests

Readme

Keywords

Package Sidebar

Install

npm i not-for-ie

Weekly Downloads

0

Version

0.9.2

License

MIT

Unpacked Size

6.39 kB

Total Files

4

Last publish

Collaborators

  • myterminal