Code Monkey home page Code Monkey logo

add-to-homescreen's People

Contributors

03c avatar atsushisakai avatar benjiwheeler avatar bleistivt avatar ccallebs avatar cgwyllie avatar chok avatar dryabov avatar eidng8 avatar filipgolonka avatar ginlime avatar holtkamp avatar jriff avatar next-marianmoldovan avatar ohryan avatar p8 avatar pedroabreu avatar peteruithoven avatar raiper34 avatar rbu avatar richardlitt avatar rogere avatar royarisse avatar shaula avatar shepard avatar shlee322 avatar ssokurenko avatar suciokastro avatar szikszail avatar valenso 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  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  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  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

add-to-homescreen's Issues

Issue with private browsing

Hey, just letting you know that when the user has Safari on private browsing, the user can't close the bubble.

I think the issue is because of sessionStorage when in private browsing, I worked around this in a way by reordering the clicked function to have close() get run first, so that at least the user can close the bubble.

Version 3.0.7 line 339 returns null for this.session:

Hi,

I upgraded from v2.0.8 to v3.0.7.

Version 3.0.7 line 339 returns null for this.session

so this line fails:
var lastDisplayTime = this.session.lastDisplayTime;

this error occurs:
[Error] TypeError: 'null' is not an object (evaluating 'this.session.lastDisplayTime')
show (addtohomescreen.min.js, line 2)

I had to patch it with:
if (this.session !== null && typeof this.session === 'object') {
var lastDisplayTime = this.session.lastDisplayTime;
} else {
var lastDisplayTime = 0;
}

Best,

Philipp

Set page to be bookmarked

Is there anyway with this code to bookmark a different page than the page on which the popup is shown? For example, I'd like to display the popup on example.com/getourapp but bookmark example.com/app.

Thanks!

Modal false still prevents clicks

Using modal: false still covers my DOM with the div .ath-viewport so I can't click on elements visible behind the modal that comes down.

My code during testing:

addToHomescreen({
    startDelay: 2,
    modal: false,
    displayPace: 0,
    icon: false
});

Script doesn't word correctly on iOS5.1

On iPhone4S/iOS5.1, when screen is landscape, the bubble isn't centered.
I suggest that the orientationCheck() function be like this:
balloon.style.marginLeft = -Math.round(balloon.offsetWidth / 2) - ( w.orientation%180 && OSVersion >= 6 ? 40 : 0 ) + 'px';

thanks

No menu button in Chrome on some android devices

Some Android devices (like the Samsung Note) have a hardware menu key. If this is the case, Chrome hides the "three vertical dots" menu button in its interface so the ATH message ends up pointing the 'open tabs' button.

I didn't find a way to detect if the existence of a hardware menu button for a web app (although it looks like you can on a native app). A potential workaround could be to hide the arrow and change the message to say "menu" button instead of the image?

(BTW, thanks for this plugin!)

Use bigger icon size?

The apple-touch-icon that is displayed is small, so it is zoomed-in and gets pixelated.

If a larger apple-touch-icon is available, that one should be used instead.

I am testing on iPhone 4 with iOS 6.

Popup too far from share button in iPhone iOS 6

The popup is popping up too far from the share button on my iPhone 4s device and in simulator as well.

I've tried changing:

     bottomOffset: 14

to

     bottomOffset: 0

on both the addtohome.js and a custom script on the index.html page like so:

    var addToHomeConfig = {
animationIn: 'fade',
animationOut:'bubble',
lifespan:10000,
expire: 720,    // Show the message only once every 12 hours
    bottomOffset: 0,
touchIcon:true
   };

Anyone else has this issue?

BTW, works perfectly on the iPad 2 iOS 6 and in the simulator.

Here's a pic from the iPhone 5 simulator: http://syntheticmedia.net/popup.png

Info Windows phone

Hello, I know that this script currently does not work on Windows Phone,

I saw the code and I know that this request is in TODO ..

As a developer I be able to test on my Windows Phone Nokia Lumia 820 possible release. (I have preview developer release Win 8.1 Phone) and IE browser have a possibility to ADD to Start Web Page...

greetings
Paul

wrong icon used for retina devices if order of icon definitions in HTML header is not descending

The code used to determine the touchIcon URL takes account of the ordering of icon definitions. It always returns the first icon found in DOM. If this is the icon with the lowest resolution. That's the one that will be displayed. Even on a retina device.

> document.querySelector('head link[rel^=apple-touch-icon][sizes="114x114"],head link[rel^=apple-touch-icon][sizes="144x144"],head link[rel^=apple-touch-icon]')
always returns: <link rel="apple-touch-icon" href="/apple-touch-icon-57x57.png" />

According to https://developer.mozilla.org/en-US/docs/Web/API/Element.querySelector

Summary
Returns the first element that is a descendent of the element on which it is invoked that matches the specified group of selectors.

Syntax
In this example, the first style element which either has no type or has type text/css in the HTML document body is returned:
var el = document.body.querySelector("style[type='text/css'], style:not([type])");

Therefore to currently get a retina icon on a retina device the icon definition in the HTML header has to be in descending order

<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon-57x57.png" />

Maybe you should mention this in the documentation

Ios 6 and iphone 5

Whit Ios 6.1.3 and Iphone 5 after create a icons on device and click it.. open the site not in full screen but in Iphone 4/4s resolution mode... on ipad 4 whit same ios e iphone 4/4s same ios the site is open in full screen resolution..

any fix?

.show(true) fails if debug mode off on unsupported device

  1. Create the object using the "OPEN THE POP UP PROGRAMMATICALLY" method with the debug option false or not specified
  2. Use the .show method with the 'true' flag to make sure the pop-up comes up for testing.
    In Chrome on Windows, you get a JavaScript error from line 361:
    Uncaught TypeError: Cannot set property 'lastDisplayTime' of null
    The relevant code:
    // increment the display count
    this.session.lastDisplayTime = now;

This may be kind of an odd combination of steps, but seems like it should be handled more gracefully.

Add action callbacks

I want to count the action times that popup show , click and reset, so I add three other options to the addToHomeConfig:

initCallback: function() {},
clickCallback: function() {},
resetCallback: function() {}

then add function call in every action, in init(), for example:

if ( options.initCallback ) setTimeout(function() { try {options.initCallback();} catch(e) {console.log(e);} }, 0);

This may make the code unsafe, but really useful.

Fatal error on older devices "Unable to get property 'length' of undefined or null reference"

Oh man am I glad to have found this library was the cause for my issues. All JS execution was stopping because of the following JS error:

Unable to get property 'length' of undefined or null reference

I managed to get a remote debugger working since this crappy Nokia Lumina phone doesn't have anything to help.

ANYWAY. It was failing on a line from this library's code. I can't tell exactly where as it only gives me a line number, but it's one of the following:

ath.language=ath.language.length==2

var isValidLocation=!this.options.validLocation.length

for(var i=this.options.validLocation.length;

I'll keep digging to find out exactly which one.

Language is always set to "en_us"

The line #99 :

ath.language = ath.language.length == 2 && ath.language + '_' + ath.language;

Should be something like this because actually it set the language to false

ath.language = ath.language.length == 2 ? ath.language + '_' + ath.language : ath.language;

Only show call to action once

Hi,

Is there any setting available to have the popup only appear one time, even after they reopen their browser? That way they're not pestered by it everytime they visit the page within safari, even if they've already added the app to their homescreen.

I'd be willing to add this feature in if it's not currently available and it's something that would be desired.

Thanks

Errors in Polish translation

Polish [pl_pl] translation contains orthographic and interpunction errors and is not up to date with iOS 7 label for "Add to home screen" button. So it should be as following:

Aby zainstalować tę aplikację na %device dotknij %icon a następnie 'Dodaj do ekranu początkowego'.

(Although I would personally drop the "%device" part I see that you keep it in all the translations so I do not suggest that.)

works only once per device -help pls :)

Hi,

I don't really understand why, but when i create a new page and add add2home it works. If I refresh the browser it doesn't appear again. No matter what I do -clear the cache or even restart the iphone, it won't appear again. Here's how I implemented the code:

<script type="text/javascript"> if ('standalone' in navigator && !navigator.standalone && (/iphone|ipod|ipad/gi).test(navigator.platform) && (/Safari/i).test(navigator.appVersion)) { var addToHomeConfig = { animationIn:'bubble', // Animation In animationOut:'drop', // Animation Out lifespan:10000, // The popup lives 10 seconds expire:2, // The popup is shown only once every 2 minutes touchIcon:true, message:'Install this book on your %device: Tap on the`%icon`and then Add to Home Screen.' }; document.write(''); document.write('<script type="application\/javascript" src="http://www.sangayoga.org/add2home/src/add2home.js" charset="utf-8"><\/s' + 'cript>'); } </script>

Remove CloseButton

I totally respect that this is an important feature in most applications. I have built offline apps that need to be saved to the home screen in order to run correctly. Therefore - I need to make "adding to homescreen" required.

How do you recommend I remove the close button - without breaking anything else.

Are you still maintaining this repo?

Hi,

Just wondering if you are still maintaining this repo. There seems to be a fare few legitimate pull requests pending.

I'd be have to help if you don't have the time.

Apple-Touch-Icon sizes

If multiple touch icons, all with different sizes, are supplied in the document but the iDevice is not retina then no touchIcon is displayed. I believe the following section of code is the culprit.

    if ( icons.length ) {
        for ( i = 0, l = icons.length; i < l; i++ ) {
            sizes = icons[i].getAttribute('sizes');

            if ( sizes ) {
                if ( isRetina && sizes == '114x114' ) {
                    touchIcon = icons[i].href;
                    break;
                }
            } else {
                touchIcon = icons[i].href;
            }
        }

        touchIcon = '<span style="background-image:url(' + touchIcon + ')" class="addToHomeTouchIcon"></span>';
    }

After bookmarking it is showing popup.

For the first time I am getting a popup and I am adding that link to bookmarks and after clearing cache of iPhone browser(Safari) again it is showing popup. It should never come back if I have already Bookmarked the site.

cs_cz localization

Czech (cs_cz) localisation is included in the source file but misses in the readme file.

Localized string is not translated correctly, please update it to the:
'Pro instalaci aplikace na Váš %device stiskněte %icon a v nabídce vyberte Přidat na plochu.'

setposition problem

hi there,

when you have a look at your live demo at http://cubiq.org/dropbox/a2h/examples/simple/, you´ll see, that on orientation change back from landscape to portrait, the content is slightly moved to the left due to your script. when you i close the overlay or wait for it to close itself the problem is gone. that is exactly the problem that i have at the moment with the code. i tried to play around with your setPosition function and indeed that code causes this problem. it seems that the animation is causing this. any ideas on this topic? i also would be happy if the bubble is not moving from its previous position than rather reposition itself from the center of the screen or whatever from the beginning maybe.

thanks for any help

dutch translation v3

nl_nl: {
message: 'Om deze webapp op je telefoon te installeren, klik op %icon en dan %action.',
action: { ios: 'Voeg toe aan beginscherm', android: 'Toevoegen aan startscherm', windows: 'pin to start' }
}

PS. i don't know the correct translation which is used on windows phone.

Turkish Wrong Translation

Hi,

The Turkish (tr_tr) translation is so wrong . The translation says that " After installing this app to %device, touch %icon to Add Home Screen. "

It should be:

"Bu uygulamayı %device'a eklemek için %icon simgesine sonrasında 'Ana Ekrana Ekle' düğmesine basın."

addtohomescreen triggered at first visit although returningVisitor is set to true

Hi,

I really liked the concept for isReturningVisitor to maximize the change of the user to add your webapp to home screen.
I having issue with isReturningVisitor settings

Scenario :
1 - Reset iOS simulator (that will clear the localStorage, sessionStorage, the lot) --> simulate first visit
2 - I ran the suggest-config example from master
3 - Got the add to home screen bubble on the first visit (should be only on the second)

config : addToHomeConfig = {
returningVisitor: true, // Show the message only to returning visitors (ie: don't show it the first time)
expire: 720 // Show the message only once every 12 hours
};

is that a known issue ?

iso 7

add ios7 compatibility

Support for Normal Android Browser?

Is it possible to add support for the normal Android Browser, too? I'm not very familiar with all the Android stuff, but it's possible to a homescreen-icon through the star button in the browser and switch the option "Add to" , to "Homescreen".
It's not very different to the normal Chrome Action, just one step more.

PS: I already saw the old and closed issue ticket, but maybe you think about it again :)

If user closes balloon it shows up again in same session

From the tutorial:
'If the user intentionally closes the balloon, it won’t show up again for all the duration of that session. This feature overrides all your configurations, even if you set the balloon to show up every single time, if the user taps the close button the message won’t be shown until the browser is closed and reopened.'

For me, this is not working. Even if the user closes the balloon it shows up again. Not always, but a lot of the times. What could be causing this? I'm just using the standard settings. Tested with Safari on an iPhone 3GS iOS 6.1.6.

Anyone having the same issue?

[enhancement] Add missing bower.json.

Hey, maintainer(s) of cubiq/add-to-homescreen!

We at VersionEye are working hard to keep up the quality of the bower's registry.

We just finished our initial analysis of the quality of the Bower.io registry:

7530 - registered packages, 224 of them doesnt exists anymore;

We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).

Sadly, your library cubiq/add-to-homescreen is one of them.

Can you spare 15 minutes to help us to make Bower better?

Just add a new file bower.json and change attributes.

{
  "name": "cubiq/add-to-homescreen",
  "version": "1.0.0",
  "main": "path/to/main.css",
  "description": "please add it",
  "license": "Eclipse",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {
    "<dependency_name>": "<semantic_version>",
    "<dependency_name>": "<Local_folder>",
    "<dependency_name>": "<package>"
  },
  "devDependencies": {
    "<test-framework-name>": "<version>"
  }
}

Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.

NB! Please validate your bower.json with jsonlint before commiting your updates.

Thank you!

Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!

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.