GithubHelp home page GithubHelp logo

doc22940 / upgrade-browser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreasbm/upgrade-browser

1.0 1.0 0.0 579 KB

A simple customizable HTML file to show users that should upgrade their browser.

License: MIT License

HTML 100.00%

upgrade-browser's Introduction

Upgrade Browser

This repository contains a simple upgrade-browser.html you can show to your visitors if their browser is not supported. The buttons and download links for the following browsers will be shown: chrome, edge, firefox, opera, safari.

Example 1

๐Ÿ‘ How to use

I recommend that you do some feature checking before showing the page. Here's an example of what you could do if you only wanted to supported browsers with support for CSS grids and custom elements.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Upgrade Browser (demo)</title>
</head>
<body>

<p>Only show this if CSS grids and custom elements are supported.</p>

<script type="text/javascript">
  (function () {
    var supportsGrid = ("grid-column" in document.documentElement.style || "msGridColumn" in document.documentElement.style);
    var supportsCustomElements = ("customElements" in window);
    var supported = supportsCustomElements && supportsGrid;

    // Show the upgrade-browser dialog if the browser is not supported
    if (!supported) {
      window.location = "upgrade-browser.html?nofirefox&noopera";
    }
  })();
</script>
</body>
</html>

As seen in the above code at window.location = "upgrade-browser.html?nofirefox&noopera";, the URL of the upgrade-browser.html file may contain a query that specifies which browsers that should not be recommended to the users. You are able to specify the following fragments in the query.

  • "nochrome"
  • "noedge"
  • "nofirefox"
  • "noopera"
  • "nosafari"

You are also able to specify a title, a subtitle and a backgroundColor as a hex without the #.

...
window.location = "upgrade-browser.html?title=No Support&subtitle=Our app does not support your browser. Please install another&backgroundColor=000000";
...

Here's how that would look.

Example 2

๐ŸŽ‰ License

MIT license

upgrade-browser's People

Contributors

andreasbm avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.