Skip to content

MarketingPipeline/Emoji-Fallback.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Emoji-Fallback.js

Replaces emoji characters with emoji images on devices that do not have emoji support with image emojis using Twemoji if needed.

Some older device's do not have emoji support and some emojis are shown as text character's like this or sometimes not all. This script provides support on ALL devices by checking if there is emoji support on the device - if no emoji support is detected, then emoji's are replaced with images. For example: will become replaced with a img of a smiley face on a device with no emoji support.

Example and usage

You can view a demo of Emoji Fallback in use here.

How to use Emoji-Fallback.js:

<!doctype html>
<html>
<head>
  <title>Emoji-Fallback.js Basic Example</title>
</head>
<body>
  <script type="module">
    import {
      emojiFallback,
      emojiSupported
    } from "https://cdn.jsdelivr.net/gh/MarketingPipeline/Emoji-Fallback.js@latest/dist/emoji-fallback.min.js";
 
    !async function() {
      const isSupported = emojiSupported();
      console.log(`Emoji supported: ${isSupported}`);
      if (!isSupported) {
        await emojiFallback();
        console.log("Emoji's rendered via fallback");
      }
    }()
    emojiFallback();
  </script>
</body>
</html>

For more advanced usage - see documentation here.

Contributing GitHub

Want to improve this? Create a pull request with detailed changes / improvements! If approved you will be added to the list of contributors of this awesome project!

See also the list of contributors who participate in this project.

License GitHub

This project is licensed under the MIT License - see the LICENSE.md file for details.