GithubHelp home page GithubHelp logo

addtohomescreen's People

Contributors

ng-chicago avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

addtohomescreen's Issues

Chrome on iPhone detected as Safari

when I use chrome on iPhone here is the user agent object:

isStandalone: false
isChrome: false
...
isSafari: true
isIOS: true
isMobile: true

mozilla/5.0 (iphone; cpu iphone os 12_2 like mac os x)
applewebkit/605.1.15(khtml, like gecko)
crios/74.0.3729.155 mobile/15e148 safari/605.1

AddToHomeScreen on Vue

Hi,

I'm trying to follow your example to implement add to home screen button on a Vue project but I'm having couple of issues

My JS looks like this
window.addEventListener('beforeinstallprompt', (e) => {
// show your custom button

// Prevent Chrome 67 and earlier from automatically showing the prompt
// no matter what, the snack-bar shows in 68 (beta 06/16/2018 11:05 AM)
e.preventDefault();

// Save the prompt so it can be displayed when the user wants
this.deferredPrompt = e; 

});

window.addEventListener('appinstalled', (evt) => {
// if installed, hide your custom button?
// if installed, call Google Analytics to track?
app.logEvent('a2hs', 'installed');
});

if (window.matchMedia('(display-mode: standalone)').matches) {
// do things here
// e.g. call Google Analytics to track standalone use
}

On my HTML I added a
button class="btn-a2hs" type="button">Add Shortcut To Home/Apps Screen

The console does not show any errors but the button is showing at all times and that does not seems right, it should show and hide depending.

where is window.addEventListener?

Hi,

I'm not seeing where you put

 window.addEventListener('beforeinstallprompt', (e) => {})

why you can call this.deferredPrompt.prompt();

Do you have any react example? I'm struggling to make this work on react project.

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.